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, 4 Dec 2021 09:37:57 +0000 (09:37 +0000)
commitfcdf0c595914ca3b00691d1718bf0d417c45932f
tree3ca1efb7c9791717327d6318be8ae6e88ec6579a
parent9a0d6f69c79612a6b58d9ac6f18aa6476c7ff823
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