aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJob Noorman <jnoorman@igalia.com>2023-09-09 10:24:16 +0200
committerJob Noorman <jnoorman@igalia.com>2023-09-09 12:06:39 +0200
commit649cac3b627fa3d466b8807536c8be970cc8c32f (patch)
tree35ee0bdbdb67a3c54f7adbc87bd3f405ee036be6 /clang/lib/Lex/ModuleMap.cpp
parent0aa459fc8ae823308dd964be89928d558663196d (diff)
downloadllvm-649cac3b627fa3d466b8807536c8be970cc8c32f.zip
llvm-649cac3b627fa3d466b8807536c8be970cc8c32f.tar.gz
llvm-649cac3b627fa3d466b8807536c8be970cc8c32f.tar.bz2
[ELF][RISCV] Implement --emit-relocs with relaxation
Linker relaxation may change relocations (offsets and types). However, when --emit-relocs is used, relocations are simply copied from the input section causing a mismatch with the corresponding (relaxed) code section. This patch fixes this as follows: for non-relocatable RISC-V binaries, `InputSection::copyRelocations` reads relocations from the relocated section's `relocations` array (since this gets updated by the relaxation code). For all other cases, relocations are read from the input section directly as before. In order to reuse as much code as possible, and to keep the diff small, the original `InputSection::copyRelocations` is changed to accept the relocations as a range of `Relocation` objects. This means that, in the general case when reading from the input section, raw relocations need to be converted to `Relocation`s first, which introduces quite a bit of boiler plate. It also means there's a slight code size increase due to the extra instantiations of `copyRelocations` (for both range types). Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D159082
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions