]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: don't assume cc supports -gno-record-gcc-switches
authorDamien Neil <dneil@google.com>
Fri, 19 Feb 2016 17:58:22 +0000 (09:58 -0800)
committerDamien Neil <dneil@google.com>
Fri, 19 Feb 2016 19:12:56 +0000 (19:12 +0000)
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 <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/build.go

index 1932f324eaa73afe76d14fd8153a0ce1d96605ed..e65aee4a27b31ba043d4b0b8683d00840f4a7e87 100644 (file)
@@ -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.