BUILD: makefile: add -Wno-atomic-alignment to work around clang abusive warning
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Jan 2022 13:51:56 +0000 (14:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 10 Jan 2022 07:38:21 +0000 (08:38 +0100)
commit755b7b3eeff7cf4d19fbd2e0817c6aedad1b6379
treef7979994ecde29c940a460e4a909a328dfa3ed05
parent114d56e215dcacd143f630a2327cc6ef2648e756
BUILD: makefile: add -Wno-atomic-alignment to work around clang abusive warning

As reported in github issue #1502, clang, when building for i386, will
try to use CMPXCHG8B-based loops for 64-bit atomic operations, and emits
warnings for all 64-bit operands that are not 64-bit aligned, an alignment
that is *not* required by the ABI, that the compiler itself does not
enforce, and that the intel SDM clearly says is not required on this
32-bit platform for this operation. But this is likely an excessive
outcome of the same code being used in 64-bit for CMPXCHG16B which does
require proper alignment. Firefox already gave up on this one 3 years
ago, let's not waste our time arguing and just shut up the warning
instead. It might hide some real bugs in the future but till now
experience showed that overall it's unlikely.

This should be backported to all maintained branches that use 64-bit
atomic ops (e.g. for counters).

Thanks to Brad Smith for reporting it and confirming that shutting the
warning addresses it.

(cherry picked from commit 790169fe69c139e4fb6fc3046985696aa78c0569)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit bd20a3ace45ca7db952ebf4078cf6cbcbe4886b9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a2701354a97a75160c006621e0fd5d5e6e337f6d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
Makefile