Skip to content

Commit 62d1a0a

Browse files
committed
ELF: Add support for R_AARCH64_INST32 relocation.
The R_AARCH64_INST32 relocation type is to support deactivation symbols. For more information, see the RFC: https://discourse.llvm.org/t/rfc-deactivation-symbols/85556 TODO: - Agree on semantics and relocation type number. - Add tests. Pull Request: llvm#133534
1 parent 3fc8e47 commit 62d1a0a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lld/ELF/Arch/AArch64.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
136136
switch (type) {
137137
case R_AARCH64_ABS16:
138138
case R_AARCH64_ABS32:
139+
case R_AARCH64_INST32:
139140
case R_AARCH64_ABS64:
140141
case R_AARCH64_FUNCINIT64:
141142
case R_AARCH64_ADD_ABS_LO12_NC:
@@ -281,6 +282,7 @@ int64_t AArch64::getImplicitAddend(const uint8_t *buf, RelType type) const {
281282
case R_AARCH64_PREL16:
282283
return SignExtend64<16>(read16(ctx, buf));
283284
case R_AARCH64_ABS32:
285+
case R_AARCH64_INST32:
284286
case R_AARCH64_PREL32:
285287
return SignExtend64<32>(read32(ctx, buf));
286288
case R_AARCH64_ABS64:
@@ -508,6 +510,12 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
508510
checkIntUInt(ctx, loc, val, 32, rel);
509511
write32(ctx, loc, val);
510512
break;
513+
case R_AARCH64_INST32:
514+
if (!rel.sym->isUndefined()) {
515+
checkIntUInt(ctx, loc, val, 32, rel);
516+
write32(ctx, loc, val);
517+
}
518+
break;
511519
case R_AARCH64_PLT32:
512520
case R_AARCH64_GOTPCREL32:
513521
checkInt(ctx, loc, val, 32, rel);

llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ ELF_RELOC(R_AARCH64_LD64_GOT_LO12_NC, 0x138)
6161
ELF_RELOC(R_AARCH64_LD64_GOTPAGE_LO15, 0x139)
6262
ELF_RELOC(R_AARCH64_PLT32, 0x13a)
6363
ELF_RELOC(R_AARCH64_GOTPCREL32, 0x13b)
64+
ELF_RELOC(R_AARCH64_INST32, 0x13c)
6465
// General dynamic TLS relocations
6566
ELF_RELOC(R_AARCH64_TLSGD_ADR_PREL21, 0x200)
6667
ELF_RELOC(R_AARCH64_TLSGD_ADR_PAGE21, 0x201)

0 commit comments

Comments
 (0)