From 8c862c07177a70b556320f386ccd4cdb76421a26 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 8 Jun 2019 19:31:54 +0000 Subject: 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. (cherry picked from commit 0b7f81f560c602f32cfc90fd3fb5f1c52f06ad49) 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); } -- cgit v0.10.2-6-g49f6