summaryrefslogtreecommitdiff
path: root/rts/LinkerInternals.h
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2020-05-14 08:14:44 +0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-23 07:55:29 -0400
commitdff1cb3d9c111808fec60190747272b973547c52 (patch)
tree5abbeff46f069551d448fdf37f87ee4c0e31bc72 /rts/LinkerInternals.h
parent7f44df1ec6df2b02be83e41cec4dc3b5f7f540f0 (diff)
downloadhaskell-dff1cb3d9c111808fec60190747272b973547c52.tar.gz
[linker] Fix out of range relocations.
mmap may return address all over the place. mmap_next will ensure we get the next free page after the requested address. This is especially important for linking on aarch64, where the memory model with PIC admits relocations in the +-4GB range, and as such we can't work with arbitrary object locations in memory. Of note: we map the rts into process space, so any mapped objects must not be ouside of the 4GB from the processes address space.
Diffstat (limited to 'rts/LinkerInternals.h')
-rw-r--r--rts/LinkerInternals.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index cf0cd35167..1f63f0c485 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -14,6 +14,7 @@
#if RTS_LINKER_USE_MMAP
#include <sys/mman.h>
+void* mmap_next(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
#endif
void printLoadedObjects(void);
@@ -293,7 +294,7 @@ void exitLinker( void );
void freeObjectCode (ObjectCode *oc);
SymbolAddr* loadSymbol(SymbolName *lbl, RtsSymbolInfo *pinfo);
-void *mmapForLinker (size_t bytes, uint32_t flags, int fd, int offset);
+void *mmapForLinker (size_t bytes, uint32_t prot, uint32_t flags, int fd, int offset);
void mmapForLinkerMarkExecutable (void *start, size_t len);
void addProddableBlock ( ObjectCode* oc, void* start, int size );