[all-commits] [llvm/llvm-project] 7ffabb: [ELF] Support R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Nov 21 07:43:43 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7ffabb61a5569444b5ac9322e22e5471cc5e4a77
https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
Author: Fangrui Song <i at maskray.me>
Date: 2023-11-21 (Tue, 21 Nov 2023)
Changed paths:
M lld/ELF/Arch/RISCV.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/Relocations.h
A lld/test/ELF/riscv-reloc-leb128.s
Log Message:
-----------
[ELF] Support R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 in non-SHF_ALLOC sections (#72610)
For a label difference like `.uleb128 A-B`, MC generates a pair of
R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 if A-B cannot be folded as a
constant. GNU assembler generates a pair of relocations in more cases
(when A or B is in a code section with linker relaxation).
`.uleb128 A-B` is primarily used by DWARF v5
.debug_loclists/.debug_rnglists (DW_LLE_offset_pair/DW_RLE_offset_pair
entry kinds) implemented in Clang and GCC.
`.uleb128 A-B` can be used in SHF_ALLOC sections as well (e.g.
`.gcc_except_table`). This patch does not handle SHF_ALLOC.
`-z dead-reloc-in-nonalloc=` can be used to change the relocated value,
if the R_RISCV_SET_ULEB128 symbol is in a discarded section. We don't
check the R_RISCV_SUB_ULEB128 symbol since for the expected cases A and
B should be defined in the same input section.
More information about the All-commits
mailing list