]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: pass arch-specific flags to external linker when testing supported flag
authorCherry Zhang <cherryyz@google.com>
Tue, 15 Dec 2020 23:31:21 +0000 (18:31 -0500)
committerCherry Zhang <cherryyz@google.com>
Wed, 16 Dec 2020 16:37:40 +0000 (16:37 +0000)
commita318d56c1e6e89996a3852a780f45c792d860d64
treec54dcc08ab0313bb5e09d40e912a74d137de582a
parentf4e7a6b905ce60448e506a3f6578d01b60602cdd
cmd/link: pass arch-specific flags to external linker when testing supported flag

When testing if a flag (e.g. "-no-pie") is supported by the
external linker, pass arch-specific flags (like "-marm").

In particular, on the ARM builder, if CGO_LDFLAGS=-march=armv6
is set, the C toolchain fails to build if -marm is not passed.

# cc -march=armv6 1.c
1.c: In function 'main':
1.c:3:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
 int main() {
 ^~~

This makes the Go linker think "-no-pie" is not supported when it
actually is.

Passing -marm makes it work.

Fixes #43202.

Change-Id: I4e8b71f08818993cbbcb2494b310c68d812d6b50
Reviewed-on: https://go-review.googlesource.com/c/go/+/278592
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/lib.go