diff options
| author | Fangrui Song <i@maskray.me> | 2023-12-07 12:10:41 -0800 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2023-12-07 12:10:42 -0800 |
| commit | a4d4b45aef6dbac1cead60dcba5e60939fc1656d (patch) | |
| tree | f24cdd01a5cc5f7e9f6c4e1302763430930ba51f | |
| parent | 2b1c76c7c4d62f4470fe1527bf239f380c19760a (diff) | |
| download | llvm-a4d4b45aef6dbac1cead60dcba5e60939fc1656d.zip llvm-a4d4b45aef6dbac1cead60dcba5e60939fc1656d.tar.gz llvm-a4d4b45aef6dbac1cead60dcba5e60939fc1656d.tar.bz2 | |
[ELF] relocateNonAlloc: move likely expr == R_ABS before unlikely R_SIZE. NFC
| -rw-r--r-- | lld/ELF/InputSection.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 145d55d..2c06bb5 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -999,20 +999,20 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) { if (config->relocatable && (RelTy::IsRela || sym.type != STT_SECTION)) continue; - if (expr == R_SIZE) { - target.relocateNoSym(bufLoc, type, - SignExtend64<bits>(sym.getSize() + addend)); - continue; - } - // R_ABS/R_DTPREL and some other relocations can be used from non-SHF_ALLOC // sections. - if (expr == R_ABS || expr == R_DTPREL || expr == R_GOTPLTREL || + if (LLVM_LIKELY(expr == R_ABS) || expr == R_DTPREL || expr == R_GOTPLTREL || expr == R_RISCV_ADD) { target.relocateNoSym(bufLoc, type, SignExtend64<bits>(sym.getVA(addend))); continue; } + if (expr == R_SIZE) { + target.relocateNoSym(bufLoc, type, + SignExtend64<bits>(sym.getSize() + addend)); + continue; + } + std::string msg = getLocation(offset) + ": has non-ABS relocation " + toString(type) + " against symbol '" + toString(sym) + "'"; |
