From: Damien Neil Date: Fri, 19 Feb 2016 17:58:22 +0000 (-0800) Subject: cmd/go: don't assume cc supports -gno-record-gcc-switches X-Git-Tag: go1.7beta1~1827 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0e34737c9aea6680b0a2a135cdf80557d61b83ce;p=gostls13.git cmd/go: don't assume cc supports -gno-record-gcc-switches NetBSD's C compiler appears to support -fdebug-prefix-map but not -gno-record-gcc-switches. Remove assumption that support for the former implies the latter. Change-Id: Iecad9e4f497ea4edc1ce440010e6fe19dc3e0566 Reviewed-on: https://go-review.googlesource.com/19686 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 1932f324ea..e65aee4a27 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -2930,12 +2930,15 @@ func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string { // Tell gcc not to include the work directory in object files. if b.gccSupportsFlag("-fdebug-prefix-map=a=b") { - // -gno-record-gcc-switches is supported by all gcc/clang - // versions that support -fdebug-prefix-map. - a = append(a, "-gno-record-gcc-switches") a = append(a, "-fdebug-prefix-map="+b.work+"=/tmp/go-build") } + // Tell gcc not to include flags in object files, which defeats the + // point of -fdebug-prefix-map above. + if b.gccSupportsFlag("-gno-record-gcc-switches") { + a = append(a, "-gno-record-gcc-switches") + } + // On OS X, some of the compilers behave as if -fno-common // is always set, and the Mach-O linker in 6l/8l assumes this. // See https://golang.org/issue/3253.