diff options
author | Zejun Wu <watashi@fb.com> | 2018-10-15 13:52:53 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-15 19:24:17 -0400 |
commit | 8306141397d6e47a169dbe4b7ff1b3319a502aa7 (patch) | |
tree | 4397939b9508e4d2e06ced33d6568dd837784dfc /rts/linker/MachO.c | |
parent | 104599f3f157613589e78627c915e4dc20ee54b4 (diff) | |
download | haskell-8306141397d6e47a169dbe4b7ff1b3319a502aa7.tar.gz |
Allocate bss section within proper range of other sections
Allocate bss section within proper range of other sections:
* when `+RTS -xp` is passed, allocate it contiguously as we did for
jump islands
* when we mmap the code to lower 2Gb, we should allocate bss section
there too
This depends on {D5195}
Test Plan:
1. `./validate`
2.
with
```
DYNAMIC_GHC_PROGRAMS = NO
DYNAMIC_BY_DEFAULT = NO
```
`TEST="T15729" make test` passed in both linux and macos.
3.
Also test in a use case where we used to encouter error like:
```
ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) =
b90282ba
```
and now, everything works fine.
Reviewers: simonmar, bgamari, angerman, erikd
Reviewed By: simonmar
Subscribers: rwbarton, carter
GHC Trac Issues: #15729
Differential Revision: https://phabricator.haskell.org/D5219
Diffstat (limited to 'rts/linker/MachO.c')
-rw-r--r-- | rts/linker/MachO.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index ff8ef7a1e4..7d5ff32276 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -186,10 +186,10 @@ resolveImports( #if NEED_SYMBOL_EXTRAS #if defined(powerpc_HOST_ARCH) int -ocAllocateSymbolExtras_MachO(ObjectCode* oc) +ocAllocateExtras_MachO(ObjectCode* oc) { - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: start\n")); + IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: start\n")); // Find out the first and last undefined external // symbol, so we don't have to allocate too many @@ -218,28 +218,31 @@ ocAllocateSymbolExtras_MachO(ObjectCode* oc) } if (max >= min) { - return ocAllocateSymbolExtras(oc, max - min + 1, min); + return ocAllocateExtras(oc, max - min + 1, min, 0); } - return ocAllocateSymbolExtras(oc,0,0); + return ocAllocateExtras(oc, 0, 0, 0); } #elif defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH) int -ocAllocateSymbolExtras_MachO(ObjectCode* oc) +ocAllocateExtras_MachO(ObjectCode* oc) { - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: start\n")); + IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: start\n")); if (NULL != oc->info->symCmd) { - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: allocate %d symbols\n", oc->info->symCmd->nsyms)); - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: done\n")); - return ocAllocateSymbolExtras(oc, oc->info->symCmd->nsyms, 0); + IF_DEBUG(linker, + debugBelch("ocAllocateExtras_MachO: allocate %d symbols\n", + oc->info->symCmd->nsyms)); + IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: done\n")); + return ocAllocateExtras(oc, oc->info->symCmd->nsyms, 0, 0); } - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: allocated no symbols\n")); - IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: done\n")); - return ocAllocateSymbolExtras(oc,0,0); + IF_DEBUG(linker, + debugBelch("ocAllocateExtras_MachO: allocated no symbols\n")); + IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: done\n")); + return ocAllocateExtras(oc, 0, 0, 0); } #else |