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
committerMoritz Angermann <moritz.angermann@gmail.com>2020-11-23 14:38:38 +0000
commit170bd49df03989d2e9c976181ea6ac0856cd6853 (patch)
tree58ebdcb25703240e7899e7e7927b59bc555d4f6e /rts/linker/Elf.c
parentf49dfc83766508a47b3e0d3e964e2fb39c5590a4 (diff)
downloadhaskell-wip/T18857.tar.gz
CmmToLlvm: Declare signature for memcmpwip/T18857
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);
}
}