Commit 0b7f81f5 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot
Browse files

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.
parent cf7f36ae
...@@ -745,12 +745,8 @@ ocGetNames_ELF ( ObjectCode* oc ) ...@@ -745,12 +745,8 @@ ocGetNames_ELF ( ObjectCode* oc )
unsigned nstubs = numberOfStubsForSection(oc, i); unsigned nstubs = numberOfStubsForSection(oc, i);
unsigned stub_space = STUB_SIZE * nstubs; unsigned stub_space = STUB_SIZE * nstubs;
void * mem = mmap(NULL, size+stub_space, void * mem = mmapForLinker(size+stub_space, MAP_ANON, -1, 0);
PROT_READ | PROT_WRITE | PROT_EXEC, if( mem == NULL ) {
MAP_ANON | MAP_PRIVATE,
-1, 0);
if( mem == MAP_FAILED ) {
barf("failed to mmap allocated memory to load section %d. " barf("failed to mmap allocated memory to load section %d. "
"errno = %d", i, errno); "errno = %d", i, errno);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment