[all-commits] [llvm/llvm-project] 4ea72c: [ELF] Add target-specific relocation scanning for ...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Mar 5 20:09:01 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4ea72c1e8cbdc5918673148aef12052ae4b86ae4
https://github.com/llvm/llvm-project/commit/4ea72c1e8cbdc5918673148aef12052ae4b86ae4
Author: Fangrui Song <i at maskray.me>
Date: 2026-03-06 (Fri, 06 Mar 2026)
Changed paths:
M lld/ELF/Arch/RISCV.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/Relocations.cpp
M lld/test/ELF/riscv-reloc-leb128.s
M lld/test/ELF/riscv-vendor-relocations.s
A lld/test/ELF/riscv-vendor-relocations2.test
Log Message:
-----------
[ELF] Add target-specific relocation scanning for RISC-V (#181332)
Implement RISCV::scanSectionImpl, following the pattern established
for x86 (#178846) and AArch64 (#181099). This merges the getRelExpr
and TLS handling for SHF_ALLOC sections into the target-specific
scanner, enabling devirtualization and eliminating abstraction
overhead.
- Inline relocation classification into scanSectionImpl with a switch
on relocation type, replacing the generic rs.scan() path.
- Use processR_PC/processR_PLT_PC for common PC-relative and PLT
relocations.
- Handle TLS IE and GD directly (RISC-V does not optimize GD/LD/IE).
- Replace TLS-optimization-specific expressions for TLSDESC, following
the x86 pattern: R_RELAX_TLS_GD_TO_IE -> R_GOT_PC,
R_RELAX_TLS_GD_TO_LE -> R_TPREL. Update relocateAlloc and relax()
to dispatch on relocation type instead of RelExpr for TLSDESC.
- Simplify getRelExpr to only handle relocations needed by
relocateNonAlloc and preprocessRelocs.
- Remove RISC-V-specific checks from handleTlsRelocation (isRISCV
variable, TLSDESC label special cases).
- Move R_RISCV_VENDOR handling into the relocation type switch. An
undefined vendor symbol now gets the standard undefined symbol error
instead of a vendor-specific diagnostic.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list