mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: support windows/arm
Enable the Go linker to generate executables for windows/arm. Generates PE relocation tables, which are used by Windows to dynamically relocate the Go binary in memory. Windows on ARM requires all modules to be relocatable, unlike x86/amd64 which are permitted to have fixed base addresses. Updates #26148 Change-Id: Ie63964ff52c2377e121b2885e9d05ec3ed8dc1cd Reviewed-on: https://go-review.googlesource.com/125648 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
39e59da76d
commit
aa311fecda
7 changed files with 338 additions and 57 deletions
|
|
@ -539,13 +539,17 @@ func windynrelocsym(ctxt *Link, s *sym.Symbol) {
|
|||
r.Add = int64(targ.Plt)
|
||||
|
||||
// jmp *addr
|
||||
if ctxt.Arch.Family == sys.I386 {
|
||||
switch ctxt.Arch.Family {
|
||||
default:
|
||||
Errorf(s, "unsupported arch %v", ctxt.Arch.Family)
|
||||
return
|
||||
case sys.I386:
|
||||
rel.AddUint8(0xff)
|
||||
rel.AddUint8(0x25)
|
||||
rel.AddAddr(ctxt.Arch, targ)
|
||||
rel.AddUint8(0x90)
|
||||
rel.AddUint8(0x90)
|
||||
} else {
|
||||
case sys.AMD64:
|
||||
rel.AddUint8(0xff)
|
||||
rel.AddUint8(0x24)
|
||||
rel.AddUint8(0x25)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue