Skip to content

Commit bd2c6b4

Browse files
mauri870ezz-no
authored andcommitted
runtime/cgo: ignore -Watomic-alignment in gcc_libinit.c
When cross-compiling a cgo program with CC=clang for Linux/ARMv5, atomic warnings cause build errors, as cgo uses -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 golang#65290 Change-Id: Ie72efb77468f06888f81f15850401dc8ce2c78f9 GitHub-Last-Rev: fbad847 GitHub-Pull-Request: golang#65588 Reviewed-on: https://go-review.googlesource.com/c/go/+/562348 Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent d456b7b commit bd2c6b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/cgo/gcc_libinit.c

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
//go:build unix
66

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

0 commit comments

Comments
 (0)