diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2020-10-27 10:52:25 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-06 03:46:44 -0500 |
commit | 2cb879092c0c946f5313216fc9ce4b93954c2f74 (patch) | |
tree | dfe782a367219dbf96172b451fa3cfa7c7c1388c /rts | |
parent | c85f4928d4dbb2eb2cf906d08bfe7620d6f04ca5 (diff) | |
download | haskell-2cb879092c0c946f5313216fc9ce4b93954c2f74.tar.gz |
[AArch64] Aarch64 Always PIC
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Libdw.c | 3 | ||||
-rw-r--r-- | rts/Linker.c | 40 | ||||
-rw-r--r-- | rts/LinkerInternals.h | 1 |
3 files changed, 4 insertions, 40 deletions
diff --git a/rts/Libdw.c b/rts/Libdw.c index d45d9d0e5d..9619479313 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -133,8 +133,9 @@ int libdwLookupLocation(LibdwSession *session, Location *frame, Dwfl_Module *mod = dwfl_addrmodule(session->dwfl, addr); if (mod == NULL) return 1; + void *object_file = &frame->object_file; dwfl_module_info(mod, NULL, NULL, NULL, NULL, NULL, - &frame->object_file, NULL); + object_file, NULL); // Find function name frame->function = dwfl_module_addrname(mod, addr); diff --git a/rts/Linker.c b/rts/Linker.c index 2d54c29196..036c7937a4 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1022,42 +1022,6 @@ resolveSymbolAddr (pathchar* buffer, int size, } #if RTS_LINKER_USE_MMAP - -/* ----------------------------------------------------------------------------- - Occationally we depend on mmap'd region being close to already mmap'd regions. - - Our static in-memory linker may be restricted by the architectures relocation - range. E.g. aarch64 has a +-4GB range for PIC code, thus we'd preferrably - get memory for the linker close to existing mappings. mmap on it's own is - free to return any memory location, independent of what the preferred - location argument indicates. - - For example mmap (via qemu) might give you addresses all over the available - memory range if the requested location is already occupied. - - mmap_next will do a linear search from the start page upwards to find a - suitable location that is as close as possible to the locations (proivded - via the first argument). - -------------------------------------------------------------------------- */ - -void* -mmap_next(void *addr, size_t length, int prot, int flags, int fd, off_t offset) { - if(addr == NULL) return mmap(addr, length, prot, flags, fd, offset); - // we are going to look for up to pageSize * 1024 * 1024 (4GB) from the - // address. - size_t pageSize = getPageSize(); - for(int i = (uintptr_t)addr & (pageSize-1) ? 1 : 0; i < 1024*1024; i++) { - void *target = (void*)(((uintptr_t)addr & ~(pageSize-1))+(i*pageSize)); - void *mem = mmap(target, length, prot, flags, fd, offset); - if(mem == NULL) return mem; - if(mem == target) return mem; - munmap(mem, length); - IF_DEBUG(linker && (i % 1024 == 0), - debugBelch("mmap_next failed to find suitable space in %p - %p\n", addr, target)); - } - return NULL; -} - // // Returns NULL on failure. // @@ -1089,8 +1053,8 @@ mmap_again: debugBelch("mmapForLinker: \tflags %#0x\n", MAP_PRIVATE | tryMap32Bit | fixed | flags)); - result = mmap_next(map_addr, size, prot, - MAP_PRIVATE|tryMap32Bit|fixed|flags, fd, offset); + result = mmap(map_addr, size, prot, + MAP_PRIVATE|tryMap32Bit|fixed|flags, fd, offset); if (result == MAP_FAILED) { sysErrorBelch("mmap %" FMT_Word " bytes at %p",(W_)size,map_addr); diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 2e76a888e4..e8923fb7eb 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -14,7 +14,6 @@ #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); |