diff options
author | Ben Gamari <ben@well-typed.com> | 2019-06-08 19:31:54 (GMT) |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-06-12 12:47:52 (GMT) |
commit | 8c862c07177a70b556320f386ccd4cdb76421a26 (patch) | |
tree | 673ac63bcb95b4431ab28396b6edc952b96e0252 | |
parent | 5e6f261aee196eb5984d192dcb01710b070452b3 (diff) | |
download | ghc-wip/backport-MR1139.zip ghc-wip/backport-MR1139.tar.gz ghc-wip/backport-MR1139.tar.bz2 |
rts/linker: Use mmapForLinker to map PLTwip/backport-MR1139
The PLT needs to be located within a close distance of
the code calling it under the small memory model.
Fixes #16784.
(cherry picked from commit 0b7f81f560c602f32cfc90fd3fb5f1c52f06ad49)
-rw-r--r-- | rts/linker/Elf.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 9ea10d4..f83700a 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -732,12 +732,8 @@ ocGetNames_ELF ( ObjectCode* oc ) unsigned nstubs = numberOfStubsForSection(oc, i); unsigned stub_space = STUB_SIZE * nstubs; - void * mem = mmap(NULL, size+stub_space, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_ANON | MAP_PRIVATE, - -1, 0); - - if( mem == MAP_FAILED ) { + void * mem = mmapForLinker(size+stub_space, MAP_ANON, -1, 0); + if( mem == NULL ) { barf("failed to mmap allocated memory to load section %d. " "errno = %d", i, errno); } |