Skip to content

Commit 5ad7be5

Browse files
committed
runtime/cgo: ignore -Watomic-alignment in gcc_libinit.c
When cross-compiling a cgo program with CC=clang for Linux/ARMv5, certain atomic warnings cause build errors, as cgo employs -Werror. These warnings seem to be harmless and come from the usage of __atomic_load_n, which is emulated due to the lack of atomic instructions in armv5. Fixes [reserved] Change-Id: Ied596456e3ad64dfd23509924ecca18130b8148d
1 parent 1ffc110 commit 5ad7be5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/cgo/gcc_libinit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
//go:build unix
66

7+
// When cross-compiling to linux/armv5, atomics are emulated and cause a
8+
// compiler warning. This results in a build failure since cgo uses
9+
// -Werror. See #65290.
10+
#pragma GCC diagnostic ignored "-Watomic-alignment"
11+
712
#include <pthread.h>
813
#include <errno.h>
914
#include <stdio.h>

0 commit comments

Comments
 (0)