Skip to content

Commit

Permalink
cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
ianlancetaylor committed Jan 13, 2016
1 parent 00c0a3a commit 7ec5508
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7ec5508

Please sign in to comment.