mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj, cmd/internal/ld, cmd/7l: external linking for darwin/arm64
Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f02 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/8781 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
909bdf56d6
commit
4fd9a3fdbb
7 changed files with 213 additions and 29 deletions
|
|
@ -451,8 +451,18 @@ func relocsym(s *LSym) {
|
|||
o = 0
|
||||
}
|
||||
} else if HEADTYPE == Hdarwin {
|
||||
// ld64 for arm64 has a bug where if the address pointed to by o exists in the
|
||||
// symbol table (dynid >= 0), or is inside a symbol that exists in the symbol
|
||||
// table, then it will add o twice into the relocated value.
|
||||
// The workaround is that on arm64 don't ever add symaddr to o and always use
|
||||
// extern relocation by requiring rs->dynid >= 0.
|
||||
if rs.Type != SHOSTOBJ {
|
||||
o += Symaddr(rs)
|
||||
if Thearch.Thechar == '7' && rs.Dynid < 0 {
|
||||
Diag("R_ADDR reloc to %s+%d is not supported on darwin/arm64", rs.Name, o)
|
||||
}
|
||||
if Thearch.Thechar != '7' {
|
||||
o += Symaddr(rs)
|
||||
}
|
||||
}
|
||||
} else if HEADTYPE == Hwindows {
|
||||
// nothing to do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue