diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index e150ff26fc3b5..36ae31be6ed2a 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -267,7 +267,6 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol &s, case R_RISCV_HI20: case R_RISCV_LO12_I: case R_RISCV_LO12_S: - case R_RISCV_RVC_LUI: return R_ABS; case R_RISCV_ADD8: case R_RISCV_ADD16: @@ -373,19 +372,6 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { return; } - case R_RISCV_RVC_LUI: { - int64_t imm = SignExtend64(val + 0x800, bits) >> 12; - checkInt(ctx, loc, imm, 6, rel); - if (imm == 0) { // `c.lui rd, 0` is illegal, convert to `c.li rd, 0` - write16le(loc, (read16le(loc) & 0x0F83) | 0x4000); - } else { - uint16_t imm17 = extractBits(val + 0x800, 17, 17) << 12; - uint16_t imm16_12 = extractBits(val + 0x800, 16, 12) << 2; - write16le(loc, (read16le(loc) & 0xEF83) | imm17 | imm16_12); - } - return; - } - case R_RISCV_JAL: { checkInt(ctx, loc, val, 21, rel); checkAlignment(ctx, loc, val, 2, rel); diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst index e8b27aaf84058..17fa199f68b2f 100644 --- a/lld/docs/ReleaseNotes.rst +++ b/lld/docs/ReleaseNotes.rst @@ -39,6 +39,10 @@ ELF Improvements Breaking changes ---------------- +* Removed support for the (deprecated) `R_RISCV_RVC_LUI` relocation. This + was a binutils-internal relocation used during relaxation, and was not + emitted by compilers/assemblers. + COFF Improvements ----------------- * ``/includeglob`` has been implemented to match the behavior of ``--undefined-glob`` available for ELF. diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def index d4be34e3b37e5..65a15c2e15621 100644 --- a/llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def +++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def @@ -45,7 +45,6 @@ ELF_RELOC(R_RISCV_GOT32_PCREL, 41) ELF_RELOC(R_RISCV_ALIGN, 43) ELF_RELOC(R_RISCV_RVC_BRANCH, 44) ELF_RELOC(R_RISCV_RVC_JUMP, 45) -ELF_RELOC(R_RISCV_RVC_LUI, 46) ELF_RELOC(R_RISCV_RELAX, 51) ELF_RELOC(R_RISCV_SUB6, 52) ELF_RELOC(R_RISCV_SET6, 53)