Commit b4a2af26 authored by Cherry Zhang's avatar Cherry Zhang Committed by Carlos Amedee
Browse files

[release-branch.go1.15] cmd/link: pass arch-specific flags to external linker...

[release-branch.go1.15] 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 #46684.

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: default avatarThan McIntosh <thanm@google.com>
(cherry picked from commit a318d56c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/326711


Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
parent ab7f8297
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment