summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2019-06-08 19:31:54 +0000
committerBen Gamari <ben@smart-cactus.org>2019-06-08 15:47:18 -0400
commit944d67c9c319c00bfa792ece69e27fa66997beb1 (patch)
tree965d8d495f7ee75fe6ec9a6e966f20fe2ee477c3
parentcabbf9dd7b08509c0850dd2d00bab8fac6626ea2 (diff)
downloadhaskell-wip/T16784.tar.gz
rts/linker: Use mmapForLinker to map PLTwip/T16784
The PLT needs to be located within a close distance of the code calling it under the small memory model. Fixes #16784.
-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);
}