Commit 6417e919 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Ian Lance Taylor

cmd/link: pass provided ldflags when testing whether an ldflag is supported

It's possible for one of the ldflags to cause the compiler driver to
use a different linker than the default, so we need to make sure that
the flag is supported by whichever linker is specified.

Fixes #27110.

Change-Id: Ic0c51b886e34344d324e68cbf6673b168c14992f
Reviewed-on: https://go-review.googlesource.com/130316
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 247b034a
......@@ -1366,7 +1366,12 @@ func linkerFlagSupported(linker, flag string) bool {
}
})
cmd := exec.Command(linker, flag, "trivial.c")
var flags []string
flags = append(flags, ldflag...)
flags = append(flags, strings.Fields(*flagExtldflags)...)
flags = append(flags, flag, "trivial.c")
cmd := exec.Command(linker, flags...)
cmd.Dir = *flagTmpdir
cmd.Env = append([]string{"LC_ALL=C"}, os.Environ()...)
out, err := cmd.CombinedOutput()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment