cmd/dist: fix build failure of misc/cgo/test on arm64
authorXiangdong Ji <xiangdong.ji@arm.com>
Wed, 5 Aug 2020 06:02:58 +0000 (06:02 +0000)
committerShengjing Zhu <zhsj@debian.org>
Sat, 5 Jun 2021 11:36:34 +0000 (12:36 +0100)
commit6cf571fc68a00cd21853833fedd83fadfd3d152d
tree34b62b1cdea804cb486d67eaf0a634602a8f0e0b
parent550a6bb69e33ca60acfc57c005b91d34a6b1d88e
cmd/dist: fix build failure of misc/cgo/test on arm64

Test7978 of misc/cgo/test fails in 'dist test' on arm64 if the C compiler
is of GCC-9.4 or above and its 'outline atomics' feature is enabled, since
the internal linking hasn't yet supported "__attribute__((constructor))"
and also mis-handles hidden visibility.

Two changes are made for 'misc/cgo/test' to fix the issue:
  1. passing "-tags=internal" for the internal linking PIE case.
  2. skipping Test7978 on arm64 for the internal linking cases.

This CL fixes 'dist test' failure only, user is expected to pass the option
'-mno-outline-atomics' via CGO_CFLAGS if running into the same problem when
building cgo program using internal linking.

Updates #39466
Change-Id: I2011bb051cae7c43eb0f1c78c7f4fbdb94bf78a6

Gbp-Pq: Name 0004-cmd-dist-fix-build-failure-of-misc-cgo-test-on-arm64.patch
misc/cgo/test/issue7978.go [new file with mode: 0644]
misc/cgo/test/issue7978b.go [new file with mode: 0644]
misc/cgo/test/testx.go
src/cmd/dist/test.go