Skip to content

Commit 7ec5508

Browse files
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 <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 00c0a3a commit 7ec5508

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmd/go/build.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2941,8 +2941,8 @@ func (b *builder) gccSupportsNoPie() bool {
29412941
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
29422942
cmd.Dir = b.work
29432943
cmd.Env = envForDir(cmd.Dir, os.Environ())
2944-
err := cmd.Run()
2945-
return err == nil
2944+
out, err := cmd.CombinedOutput()
2945+
return err == nil && !bytes.Contains(out, []byte("unrecognized"))
29462946
}
29472947

29482948
// gccArchArgs returns arguments to pass to gcc based on the architecture.

0 commit comments

Comments
 (0)