[ELF] relocateAlloc: remove variables type and expr. NFC

This commit is contained in:
Fangrui Song 2021-12-12 19:31:30 -08:00
parent 4cfff19b88
commit d29766bb48
1 changed files with 6 additions and 8 deletions

View File

@ -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;