diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-10-17 15:20:46 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-24 02:43:55 -0500 |
commit | 2ed3e6c0f179c06828712832d1176519cdfa82a6 (patch) | |
tree | e590d6f89d5cdc505f3ec7d58234d77a2492fa65 /rts | |
parent | 9b95d815d718ce671e9e87b8a2eb0534ed5688dd (diff) | |
download | haskell-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')
-rw-r--r-- | rts/LinkerInternals.h | 2 | ||||
-rw-r--r-- | rts/linker/Elf.c | 11 | ||||
-rw-r--r-- | rts/linker/elf_reloc_aarch64.c | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 93e949f2f2..f060e4d38a 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -141,7 +141,7 @@ typedef struct _Segment { int n_sections; } Segment; -#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH) #define NEED_SYMBOL_EXTRAS 1 #endif 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); } } diff --git a/rts/linker/elf_reloc_aarch64.c b/rts/linker/elf_reloc_aarch64.c index cdaaa67711..8cffb9f03e 100644 --- a/rts/linker/elf_reloc_aarch64.c +++ b/rts/linker/elf_reloc_aarch64.c @@ -297,7 +297,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) { relTab->sectionHeader->sh_link, ELF64_R_SYM((Elf64_Xword)rel->r_info)); - assert(symbol != NULL); + assert(0x0 != symbol); /* decode implicit addend */ int64_t addend = decodeAddendAarch64(targetSection, rel); @@ -324,6 +324,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) { ELF64_R_SYM((Elf64_Xword)rel->r_info)); assert(0x0 != symbol); + assert(0x0 != symbol->addr); /* take explicit addend */ int64_t addend = rel->r_addend; |