Skip to content

Commit 646aaef

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 43fd622 commit 646aaef

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
@@ -135,6 +135,7 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
135135
switch (type) {
136136
case R_AARCH64_ABS16:
137137
case R_AARCH64_ABS32:
138+
case R_AARCH64_INST32:
138139
case R_AARCH64_ABS64:
139140
case R_AARCH64_ADD_ABS_LO12_NC:
140141
case R_AARCH64_LDST128_ABS_LO12_NC:
@@ -278,6 +279,7 @@ int64_t AArch64::getImplicitAddend(const uint8_t *buf, RelType type) const {
278279
case R_AARCH64_PREL16:
279280
return SignExtend64<16>(read16(ctx, buf));
280281
case R_AARCH64_ABS32:
282+
case R_AARCH64_INST32:
281283
case R_AARCH64_PREL32:
282284
return SignExtend64<32>(read32(ctx, buf));
283285
case R_AARCH64_ABS64:
@@ -505,6 +507,12 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
505507
checkIntUInt(ctx, loc, val, 32, rel);
506508
write32(ctx, loc, val);
507509
break;
510+
case R_AARCH64_INST32:
511+
if (!rel.sym->isUndefined()) {
512+
checkIntUInt(ctx, loc, val, 32, rel);
513+
write32(ctx, loc, val);
514+
}
515+
break;
508516
case R_AARCH64_PLT32:
509517
case R_AARCH64_GOTPCREL32:
510518
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)