1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:24:42 -07:00

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 <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Egon Elbre 2017-05-04 16:14:59 +03:00 committed by Alex Brainman
parent 4b2f7b4b51
commit e94b9d4143

View File

@ -1448,6 +1448,11 @@ func writearanges(ctxt *Link, syms []*Symbol) []*Symbol {
} }
func writegdbscript(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 != "" { if gdbscript != "" {
s := ctxt.Syms.Lookup(".debug_gdb_scripts", 0) s := ctxt.Syms.Lookup(".debug_gdb_scripts", 0)