Commit 2a6544b6 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle

cmd/go, cmd/link: set LC_ALL=C when checking if host compiler supports -no-pie

Fixes #15900

Change-Id: Ieada5f4e3b3b2ae358414e013f3090b4b820569b
Reviewed-on: https://go-review.googlesource.com/23536
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 66736880
...@@ -3088,7 +3088,7 @@ func (b *builder) gccSupportsFlag(flag string) bool { ...@@ -3088,7 +3088,7 @@ func (b *builder) gccSupportsFlag(flag string) bool {
} }
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
cmd.Dir = b.work cmd.Dir = b.work
cmd.Env = envForDir(cmd.Dir, os.Environ()) cmd.Env = mergeEnvLists([]string{"LC_ALL=C"}, envForDir(cmd.Dir, os.Environ()))
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
supported := err == nil && !bytes.Contains(out, []byte("unrecognized")) supported := err == nil && !bytes.Contains(out, []byte("unrecognized"))
b.flagCache[flag] = supported b.flagCache[flag] = supported
......
...@@ -1235,6 +1235,7 @@ func hostlink() { ...@@ -1235,6 +1235,7 @@ func hostlink() {
} }
cmd := exec.Command(argv[0], "-c", "-no-pie", "trivial.c") cmd := exec.Command(argv[0], "-c", "-no-pie", "trivial.c")
cmd.Dir = tmpdir cmd.Dir = tmpdir
cmd.Env = append([]string{"LC_ALL=C"}, os.Environ()...)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
supported := err == nil && !bytes.Contains(out, []byte("unrecognized")) supported := err == nil && !bytes.Contains(out, []byte("unrecognized"))
if supported { if supported {
......
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