Skip to content

Commit 88cca0b

Browse files
committed
[RISCV] Remove R_RISCV_RVC_LUI Relocation
This was removed from the ABI in riscv-non-isa/riscv-elf-psabi-doc#398. It is not emitted by LLVM, and seems to have been an internal implementation detail in binutils. This is a follow-up to 26ec5da which removed previous binutils internal relocations when they were removed from the ABI.
1 parent a608607 commit 88cca0b

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

lld/ELF/Arch/RISCV.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol &s,
267267
case R_RISCV_HI20:
268268
case R_RISCV_LO12_I:
269269
case R_RISCV_LO12_S:
270-
case R_RISCV_RVC_LUI:
271270
return R_ABS;
272271
case R_RISCV_ADD8:
273272
case R_RISCV_ADD16:
@@ -373,19 +372,6 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
373372
return;
374373
}
375374

376-
case R_RISCV_RVC_LUI: {
377-
int64_t imm = SignExtend64(val + 0x800, bits) >> 12;
378-
checkInt(ctx, loc, imm, 6, rel);
379-
if (imm == 0) { // `c.lui rd, 0` is illegal, convert to `c.li rd, 0`
380-
write16le(loc, (read16le(loc) & 0x0F83) | 0x4000);
381-
} else {
382-
uint16_t imm17 = extractBits(val + 0x800, 17, 17) << 12;
383-
uint16_t imm16_12 = extractBits(val + 0x800, 16, 12) << 2;
384-
write16le(loc, (read16le(loc) & 0xEF83) | imm17 | imm16_12);
385-
}
386-
return;
387-
}
388-
389375
case R_RISCV_JAL: {
390376
checkInt(ctx, loc, val, 21, rel);
391377
checkAlignment(ctx, loc, val, 2, rel);

llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ ELF_RELOC(R_RISCV_GOT32_PCREL, 41)
4545
ELF_RELOC(R_RISCV_ALIGN, 43)
4646
ELF_RELOC(R_RISCV_RVC_BRANCH, 44)
4747
ELF_RELOC(R_RISCV_RVC_JUMP, 45)
48-
ELF_RELOC(R_RISCV_RVC_LUI, 46)
4948
ELF_RELOC(R_RISCV_RELAX, 51)
5049
ELF_RELOC(R_RISCV_SUB6, 52)
5150
ELF_RELOC(R_RISCV_SET6, 53)

0 commit comments

Comments
 (0)