1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:10:05 -07:00

cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0

GCC 4.8 exits 1 on an unrecognized option, but GCC 4.4 and 4.5 exit 0.
I didn't check other versions, or try to figure out just when this
changed.

Fixes #13937.

Change-Id: If193e9053fbb535999c9bde99f430f465a8c7c57
Reviewed-on: https://go-review.googlesource.com/18597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-01-13 10:45:54 -08:00
parent 00c0a3a677
commit 7ec5508810

View File

@ -2941,8 +2941,8 @@ func (b *builder) gccSupportsNoPie() bool {
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
cmd.Dir = b.work
cmd.Env = envForDir(cmd.Dir, os.Environ())
err := cmd.Run()
return err == nil
out, err := cmd.CombinedOutput()
return err == nil && !bytes.Contains(out, []byte("unrecognized"))
}
// gccArchArgs returns arguments to pass to gcc based on the architecture.