]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: don't pass -gdwarf-2 to external linker
authorThan McIntosh <thanm@google.com>
Thu, 26 Oct 2017 14:15:29 +0000 (10:15 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 27 Oct 2017 14:25:12 +0000 (14:25 +0000)
Don't pass -gdwarf-2 to the external linker when external linkage is
requested. The Go compiler is now emitting DWARF version 4, so this
doesn't seem needed any more.

Fixes #22455

Change-Id: Ic4122c55e946619a266430f2d26f06d6803dd232
Reviewed-on: https://go-review.googlesource.com/73672
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/link/internal/ld/lib.go

index 377b4a4df29b52282062e58bd59aaab9dd524734..81f8e4cb446eec6c5ffe3cdc9c615001aaeb15f7 100644 (file)
@@ -1073,14 +1073,14 @@ func (ctxt *Link) hostlink() {
        argv = append(argv, *flagExtld)
        argv = append(argv, hostlinkArchArgs(ctxt.Arch)...)
 
-       if !*FlagS && !debug_s {
-               argv = append(argv, "-gdwarf-2")
-       } else if ctxt.HeadType == objabi.Hdarwin {
-               // Recent versions of macOS print
-               //      ld: warning: option -s is obsolete and being ignored
-               // so do not pass any arguments.
-       } else {
-               argv = append(argv, "-s")
+       if *FlagS || debug_s {
+               if ctxt.HeadType == objabi.Hdarwin {
+                       // Recent versions of macOS print
+                       //      ld: warning: option -s is obsolete and being ignored
+                       // so do not pass any arguments.
+               } else {
+                       argv = append(argv, "-s")
+               }
        }
 
        switch ctxt.HeadType {