summaryrefslogtreecommitdiff
path: root/rts/linker/Elf.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-17 15:20:46 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-24 02:43:55 -0500
commit2ed3e6c0f179c06828712832d1176519cdfa82a6 (patch)
treee590d6f89d5cdc505f3ec7d58234d77a2492fa65 /rts/linker/Elf.c
parent9b95d815d718ce671e9e87b8a2eb0534ed5688dd (diff)
downloadhaskell-2ed3e6c0f179c06828712832d1176519cdfa82a6.tar.gz
CmmToLlvm: Declare signature for memcmpwip/angerman/arm64
Otherwise `opt` fails with: error: use of undefined value '@memcmp$def'
Diffstat (limited to 'rts/linker/Elf.c')
-rw-r--r--rts/linker/Elf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index 023ce1f6ce..a839ab68af 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -781,7 +781,12 @@ ocGetNames_ELF ( ObjectCode* oc )
else if (!oc->imageMapped || size < getPageSize() / 3) {
bool executable = kind == SECTIONKIND_CODE_OR_RODATA;
m32_allocator *allocator = executable ? oc->rx_m32 : oc->rw_m32;
- start = m32_alloc(allocator, size, 8);
+ // align on 16 bytes. The reason being that llvm will emit see
+ // paddq statements for x86_64 under optimisation and load from
+ // RODATA sections. Specifically .rodata.cst16. However we don't
+ // handle the cst part in any way what so ever, so 16 seems
+ // better than 8.
+ start = m32_alloc(allocator, size, 16);
if (start == NULL) goto fail;
memcpy(start, oc->image + offset, size);
alloc = SECTION_M32;
@@ -940,7 +945,7 @@ ocGetNames_ELF ( ObjectCode* oc )
symbol->addr = (SymbolAddr*)(
(intptr_t) oc->sections[secno].start +
(intptr_t) symbol->elf_sym->st_value);
-
+ ASSERT(symbol->addr != 0x0);
if (ELF_ST_BIND(symbol->elf_sym->st_info) == STB_LOCAL) {
isLocal = true;
isWeak = false;
@@ -1867,6 +1872,7 @@ ocResolve_ELF ( ObjectCode* oc )
#endif
ASSERT(symbol->elf_sym->st_name == 0);
ASSERT(symbol->elf_sym->st_value == 0);
+ ASSERT(0x0 != oc->sections[ secno ].start);
symbol->addr = oc->sections[ secno ].start;
}
}
@@ -1940,6 +1946,7 @@ int ocRunInit_ELF( ObjectCode *oc )
init_start = (init_t*)init_startC;
init_end = (init_t*)(init_startC + shdr[i].sh_size);
for (init = init_start; init < init_end; init++) {
+ ASSERT(0x0 != *init);
(*init)(argc, argv, envv);
}
}