mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/ld, cmd/6l: external linking for windows/amd64
Change-Id: I2d2ea233f976aab3f356f9b508cdd246d5013e30 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/7534 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
484d9399de
commit
e7df053977
4 changed files with 66 additions and 10 deletions
|
|
@ -499,8 +499,13 @@ func relocsym(s *LSym) {
|
|||
} else {
|
||||
o += int64(r.Siz)
|
||||
}
|
||||
} else if HEADTYPE == Hwindows {
|
||||
// nothing to do
|
||||
} else if HEADTYPE == Hwindows && Thearch.Thechar == '6' { // only amd64 needs PCREL
|
||||
// PE/COFF's PC32 relocation uses the address after the relocated
|
||||
// bytes as the base. Compensate by skewing the addend.
|
||||
o += int64(r.Siz)
|
||||
// GNU ld always add VirtualAddress of the .text section to the
|
||||
// relocated address, compensate that.
|
||||
o -= int64(s.Sect.(*Section).Vaddr - PEBASE)
|
||||
} else {
|
||||
Diag("unhandled pcrel relocation for %s", headstring)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue