cmd/link: load symbols from .syso in external link mode

Fix linking with a package having a .syso file in external link mode,
that would otherwise cause an error before executing the external
linker because it can't find symbols that are exported in the said
.syso file.

Fixes #33139

Change-Id: Id3ee737fba1c6f1e37910593dfedf9c84486d398
Reviewed-on: https://go-review.googlesource.com/c/go/+/186417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
John Papandriopoulos 2019-09-29 16:59:56 -07:00 committed by Ian Lance Taylor
parent 27cf81e1b4
commit 5e514b76e2
10 changed files with 76 additions and 16 deletions

View file

@ -2348,7 +2348,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
}
put(ctxt, s, s.Name, BSSSym, Symaddr(s), s.Gotype)
case sym.SHOSTOBJ:
case sym.SHOSTOBJ, sym.SUNDEFEXT:
if ctxt.HeadType == objabi.Hwindows || ctxt.IsELF {
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
}