cmd/internal/ld, cmd/8l: external linking for windows/386

Update #4069: this CL fixes the issue on windows/386.

Signed-off-by: Shenghou Ma <minux@golang.org>
Change-Id: I2d2ea233f976aab3f356f9b508cdd246d5013e2e
Reviewed-on: https://go-review.googlesource.com/7283
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Shenghou Ma 2015-03-09 03:05:40 -04:00 committed by Minux Ma
parent b6ed943bef
commit 04642e92ac
6 changed files with 309 additions and 41 deletions

View file

@ -99,6 +99,7 @@ type Arch struct {
Elfsetupplt func()
Gentext func()
Machoreloc1 func(*Reloc, int64) int
PEreloc1 func(*Reloc, int64) bool
Lput func(uint32)
Wput func(uint16)
Vput func(uint64)
@ -744,6 +745,13 @@ func hostlink() {
if HEADTYPE == Hopenbsd {
argv = append(argv, "-Wl,-nopie")
}
if HEADTYPE == Hwindows {
if headstring == "windowsgui" {
argv = append(argv, "-mwindows")
} else {
argv = append(argv, "-mconsole")
}
}
if Iself && AssumeGoldLinker != 0 /*TypeKind(100016)*/ {
argv = append(argv, "-Wl,--rosegment")
@ -844,6 +852,9 @@ func hostlink() {
}
}
}
if HEADTYPE == Hwindows {
argv = append(argv, peimporteddlls()...)
}
if Debug['v'] != 0 {
fmt.Fprintf(&Bso, "host link:")
@ -1379,6 +1390,13 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
case SFILE:
put(nil, s.Name, 'f', s.Value, 0, int(s.Version), nil)
continue
case SHOSTOBJ:
if HEADTYPE == Hwindows {
put(s, s.Name, 'U', s.Value, 0, int(s.Version), nil)
}
continue
}
}