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)
committerRaspbian forward porter <root@raspbian.org>
Fri, 27 Aug 2021 07:38:43 +0000 (08:38 +0100)
commit9fcb26686b035c596ebc0629af4e2642c2da68fe
tree535727d9c376fb17c2a0c03052762ceebc47f306
parent790fe4d5c0ebcc9589c704bf6375040885db0859
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