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)
committerMichael Hudson-Doyle <michael.hudson@ubuntu.com>
Mon, 14 Sep 2020 21:51:42 +0000 (22:51 +0100)
commit1351851811e0692a2fcaa8088d80e0859577e15a
treebc3308165b5bb581fc38083eb86ab9af57c8af06
parent07b2abd428be9ac39d74bf4a97381b4d2b0f06d9
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