Skip to content

Commit 6b22c37

Browse files
committed
RuntimeDyldELF: Don't abort on R_AARCH64_NONE relocation
Do nothing on R_AARCH64_NONE relocation. The relocation is used by BOLT when re-linking the final binary. It is used as a dummy relocation hack in order to stop the RuntimeDyld to skip the allocation of the section. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D117066
1 parent ea9394c commit 6b22c37

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section,
422422
default:
423423
report_fatal_error("Relocation type not implemented yet!");
424424
break;
425+
case ELF::R_AARCH64_NONE:
426+
break;
425427
case ELF::R_AARCH64_ABS16: {
426428
uint64_t Result = Value + Addend;
427429
assert(static_cast<int64_t>(Result) >= INT16_MIN && Result < UINT16_MAX);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: yaml2obj %s -o %t.o
2+
# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu %t.o -printline
3+
4+
## Verify rtdyld doesn't abort in presence of R_AARCH64_NONE.
5+
6+
!ELF
7+
FileHeader:
8+
Class: ELFCLASS64
9+
Data: ELFDATA2LSB
10+
OSABI: ELFOSABI_FREEBSD
11+
Type: ET_REL
12+
Machine: EM_AARCH64
13+
Sections:
14+
- Name: .text
15+
Type: SHT_PROGBITS
16+
Flags: [ SHF_ALLOC ]
17+
- Name: .rela.text
18+
Type: SHT_RELA
19+
Link: .symtab
20+
Info: .text
21+
Relocations:
22+
- Offset: 0x0000000000000000
23+
Type: R_AARCH64_NONE
24+
Symbols:

0 commit comments

Comments
 (0)