summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2019-06-08 19:31:54 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-11 18:43:05 -0400
commit0b7f81f560c602f32cfc90fd3fb5f1c52f06ad49 (patch)
tree679928a0f22862795b7329fa5c760139116a60df /rts
parentcf7f36ae5e0ceee1c37a4c38464209f04647a470 (diff)
downloadhaskell-0b7f81f560c602f32cfc90fd3fb5f1c52f06ad49.tar.gz
rts/linker: Use mmapForLinker to map PLT
The PLT needs to be located within a close distance of the code calling it under the small memory model. Fixes #16784.
Diffstat (limited to 'rts')
-rw-r--r--rts/linker/Elf.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index b647d207cb..4378032c3e 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -745,12 +745,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);
}