From: Egon Elbre Date: Thu, 4 May 2017 13:14:59 +0000 (+0300) Subject: cmd/link/internal/ld: fix external linking on windows X-Git-Tag: go1.9beta1~323 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e94b9d41432a0560328c786b908e59c27a0a6c47;p=gostls13.git cmd/link/internal/ld: fix external linking on windows gcc on windows writes invalid location for .debug_gdb_scripts which causes the executable loading to fail. Fixes #20183 Change-Id: I5134013bc926b44a55b528f66ab79555855d1f4d Reviewed-on: https://go-review.googlesource.com/42651 Reviewed-by: Alex Brainman Run-TryBot: Alex Brainman TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/link/internal/ld/dwarf.go b/src/cmd/link/internal/ld/dwarf.go index 205b39512e..a0c5565cd2 100644 --- a/src/cmd/link/internal/ld/dwarf.go +++ b/src/cmd/link/internal/ld/dwarf.go @@ -1448,6 +1448,11 @@ func writearanges(ctxt *Link, syms []*Symbol) []*Symbol { } func writegdbscript(ctxt *Link, syms []*Symbol) []*Symbol { + if Linkmode == LinkExternal && Headtype == objabi.Hwindows { + // gcc on Windows places .debug_gdb_scripts to a wrong location + // which causes program not to run. See https://golang.org/issue/20183 + return syms + } if gdbscript != "" { s := ctxt.Syms.Lookup(".debug_gdb_scripts", 0)