[lld] d29766b - [ELF] relocateAlloc: remove variables type and expr. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 12 19:31:34 PST 2021
Author: Fangrui Song
Date: 2021-12-12T19:31:30-08:00
New Revision: d29766bb485a4b69b821f7a30acec5016ff6112c
URL: https://github.com/llvm/llvm-project/commit/d29766bb485a4b69b821f7a30acec5016ff6112c
DIFF: https://github.com/llvm/llvm-project/commit/d29766bb485a4b69b821f7a30acec5016ff6112c.diff
LOG: [ELF] relocateAlloc: remove variables type and expr. NFC
Added:
Modified:
lld/ELF/InputSection.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index a8d3163cde64..a9185f8d8a98 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1022,17 +1022,15 @@ void InputSectionBase::relocateAlloc(uint8_t *buf, uint8_t *bufEnd) {
continue;
uint64_t offset = rel.offset;
uint8_t *bufLoc = buf + offset;
- RelType type = rel.type;
uint64_t addrLoc = getOutputSection()->addr + offset;
if (auto *sec = dyn_cast<InputSection>(this))
addrLoc += sec->outSecOff;
- RelExpr expr = rel.expr;
- uint64_t targetVA = SignExtend64(
- getRelocTargetVA(file, type, rel.addend, addrLoc, *rel.sym, expr),
- bits);
+ const uint64_t targetVA =
+ SignExtend64(getRelocTargetVA(file, rel.type, rel.addend, addrLoc,
+ *rel.sym, rel.expr), bits);
- switch (expr) {
+ switch (rel.expr) {
case R_RELAX_GOT_PC:
case R_RELAX_GOT_PC_NOPIC:
target->relaxGot(bufLoc, rel, targetVA);
@@ -1044,9 +1042,9 @@ void InputSectionBase::relocateAlloc(uint8_t *buf, uint8_t *bufEnd) {
// the associated R_PPC64_GOT_PCREL34 since only the latter has an
// associated symbol. So save the offset when relaxing R_PPC64_GOT_PCREL34
// and only relax the other if the saved offset matches.
- if (type == R_PPC64_GOT_PCREL34)
+ if (rel.type == R_PPC64_GOT_PCREL34)
lastPPCRelaxedRelocOff = offset;
- if (type == R_PPC64_PCREL_OPT && offset != lastPPCRelaxedRelocOff)
+ if (rel.type == R_PPC64_PCREL_OPT && offset != lastPPCRelaxedRelocOff)
break;
target->relaxGot(bufLoc, rel, targetVA);
break;
More information about the llvm-commits
mailing list