Skip to content

Commit

Permalink
runtime/cgo: ignore -Watomic-alignment in gcc_libinit.c
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mauri870 authored and gopherbot committed Feb 10, 2024
1 parent bf821f6 commit 4a7f3ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/runtime/cgo/gcc_libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

//go:build unix

// When cross-compiling with clang to linux/armv5, atomics are emulated
// and cause a compiler warning. This results in a build failure since
// cgo uses -Werror. See #65290.
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Watomic-alignment"

#include <pthread.h>
#include <errno.h>
#include <stdio.h>
Expand Down

0 comments on commit 4a7f3ac

Please sign in to comment.