]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0
authorIan Lance Taylor <iant@golang.org>
Wed, 13 Jan 2016 18:45:54 +0000 (10:45 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 13 Jan 2016 19:29:22 +0000 (19:29 +0000)
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>

src/cmd/go/build.go

index 565ccec591487c29a040c1063427b65ca5826662..ebeb11cf636f8d6d4c52d587f1722f585dd9e8d8 100644 (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.