Skip to content

Commit a4d4b45

Browse files
committed
[ELF] relocateNonAlloc: move likely expr == R_ABS before unlikely R_SIZE. NFC
1 parent 2b1c76c commit a4d4b45

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lld/ELF/InputSection.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,20 +999,20 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
999999
if (config->relocatable && (RelTy::IsRela || sym.type != STT_SECTION))
10001000
continue;
10011001

1002-
if (expr == R_SIZE) {
1003-
target.relocateNoSym(bufLoc, type,
1004-
SignExtend64<bits>(sym.getSize() + addend));
1005-
continue;
1006-
}
1007-
10081002
// R_ABS/R_DTPREL and some other relocations can be used from non-SHF_ALLOC
10091003
// sections.
1010-
if (expr == R_ABS || expr == R_DTPREL || expr == R_GOTPLTREL ||
1004+
if (LLVM_LIKELY(expr == R_ABS) || expr == R_DTPREL || expr == R_GOTPLTREL ||
10111005
expr == R_RISCV_ADD) {
10121006
target.relocateNoSym(bufLoc, type, SignExtend64<bits>(sym.getVA(addend)));
10131007
continue;
10141008
}
10151009

1010+
if (expr == R_SIZE) {
1011+
target.relocateNoSym(bufLoc, type,
1012+
SignExtend64<bits>(sym.getSize() + addend));
1013+
continue;
1014+
}
1015+
10161016
std::string msg = getLocation(offset) + ": has non-ABS relocation " +
10171017
toString(type) + " against symbol '" + toString(sym) +
10181018
"'";

0 commit comments

Comments
 (0)