mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: emit Mach-O relocations in mmap
Following CL 240399 and CL 240400, do the same for Mach-O. Linking cmd/compile with external linking, name old time/op new time/op delta Asmb2_GC 32.7ms ± 2% 13.5ms ± 6% -58.56% (p=0.008 n=5+5) name old alloc/op new alloc/op delta Asmb2_GC 16.5MB ± 0% 6.4MB ± 0% -61.15% (p=0.008 n=5+5) Change-Id: I0fd7019d8713d1940e5fbbce4ee8eebd926451a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/241178 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
041d8850a1
commit
59a702aa6a
7 changed files with 86 additions and 60 deletions
|
|
@ -453,7 +453,6 @@ func archreloc(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r loade
|
|||
default:
|
||||
case objabi.R_ARM64_GOTPCREL,
|
||||
objabi.R_ADDRARM64:
|
||||
nExtReloc = 2 // need two ELF relocations. see elfreloc1
|
||||
|
||||
// set up addend for eventual relocation via outer symbol.
|
||||
rs, off := ld.FoldSubSymbolOffset(ldr, rs)
|
||||
|
|
@ -464,6 +463,11 @@ func archreloc(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r loade
|
|||
}
|
||||
rr.Xsym = rs
|
||||
|
||||
nExtReloc = 2 // need two ELF/Mach-O relocations. see elfreloc1/machoreloc1
|
||||
if target.IsDarwin() && rt == objabi.R_ADDRARM64 && rr.Xadd != 0 {
|
||||
nExtReloc = 4 // need another two relocations for non-zero addend
|
||||
}
|
||||
|
||||
// Note: ld64 currently has a bug that any non-zero addend for BR26 relocation
|
||||
// will make the linking fail because it thinks the code is not PIC even though
|
||||
// the BR26 relocation should be fully resolved at link time.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue