From 3e1e66fa05017f15b7e91307275975a6584cd205 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Thu, 26 Oct 2017 10:15:29 -0400 Subject: [PATCH] cmd/link: don't pass -gdwarf-2 to external linker 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 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/cmd/link/internal/ld/lib.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 377b4a4df2..81f8e4cb44 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -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 { -- 2.48.1