cmd/link: delay calculating pe file parameters after Linkmode is set

For #10776.

Change-Id: Id64a7e35c7cdcd9be16cbe3358402fa379090e36
Reviewed-on: https://go-review.googlesource.com/36975
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Alex Brainman 2017-02-14 12:01:01 +11:00
parent e31144f128
commit 0ad247c6f0
4 changed files with 23 additions and 24 deletions

View file

@ -430,6 +430,11 @@ func (ctxt *Link) loadlib() {
// We now have enough information to determine the link mode.
determineLinkMode(ctxt)
// Recalculate pe parameters now that we have Linkmode set.
if Headtype == obj.Hwindows || Headtype == obj.Hwindowsgui {
Peinit(ctxt)
}
if Linkmode == LinkExternal && SysArch.Family == sys.PPC64 {
toc := ctxt.Syms.Lookup(".TOC.", 0)
toc.Type = obj.SDYNIMPORT