[lld] ba6973c - [ELF] Change nonnull pointer parameters to references
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 22 22:02:35 PST 2021
Author: Fangrui Song
Date: 2021-12-22T22:02:29-08:00
New Revision: ba6973c89b017671b1a1cdebd6d46352e350c1e9
URL: https://github.com/llvm/llvm-project/commit/ba6973c89b017671b1a1cdebd6d46352e350c1e9
DIFF: https://github.com/llvm/llvm-project/commit/ba6973c89b017671b1a1cdebd6d46352e350c1e9.diff
LOG: [ELF] Change nonnull pointer parameters to references
Added:
Modified:
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index dd4c5f787f37..93d6ed32016f 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1578,8 +1578,8 @@ void RelocationBaseSection::addSymbolReloc(RelType dynType,
uint64_t offsetInSec, Symbol &sym,
int64_t addend,
Optional<RelType> addendRelType) {
- addReloc(DynamicReloc::AgainstSymbol, dynType, &isec, offsetInSec, sym,
- addend, R_ADDEND, addendRelType ? *addendRelType : target->noneRel);
+ addReloc(DynamicReloc::AgainstSymbol, dynType, isec, offsetInSec, sym, addend,
+ R_ADDEND, addendRelType ? *addendRelType : target->noneRel);
}
void RelocationBaseSection::addRelativeReloc(
@@ -1591,8 +1591,8 @@ void RelocationBaseSection::addRelativeReloc(
assert((!sym.isPreemptible || expr == R_GOT) &&
"cannot add relative relocation against preemptible symbol");
assert(expr != R_ADDEND && "expected non-addend relocation expression");
- addReloc(DynamicReloc::AddendOnlyWithTargetVA, dynType, &inputSec,
- offsetInSec, sym, addend, expr, addendRelType);
+ addReloc(DynamicReloc::AddendOnlyWithTargetVA, dynType, inputSec, offsetInSec,
+ sym, addend, expr, addendRelType);
}
void RelocationBaseSection::addAddendOnlyRelocIfNonPreemptible(
@@ -1603,21 +1603,21 @@ void RelocationBaseSection::addAddendOnlyRelocIfNonPreemptible(
addReloc({dynType, &isec, offsetInSec, DynamicReloc::AgainstSymbol, sym, 0,
R_ABS});
else
- addReloc(DynamicReloc::AddendOnlyWithTargetVA, dynType, &isec, offsetInSec,
+ addReloc(DynamicReloc::AddendOnlyWithTargetVA, dynType, isec, offsetInSec,
sym, 0, R_ABS, addendRelType);
}
void RelocationBaseSection::addReloc(DynamicReloc::Kind kind, RelType dynType,
- InputSectionBase *inputSec,
+ InputSectionBase &inputSec,
uint64_t offsetInSec, Symbol &sym,
int64_t addend, RelExpr expr,
RelType addendRelType) {
// Write the addends to the relocated address if required. We skip
// it if the written value would be zero.
if (config->writeAddends && (expr != R_ADDEND || addend != 0))
- inputSec->relocations.push_back(
+ inputSec.relocations.push_back(
{expr, addendRelType, offsetInSec, addend, &sym});
- addReloc({dynType, inputSec, offsetInSec, kind, sym, addend, expr});
+ addReloc({dynType, &inputSec, offsetInSec, kind, sym, addend, expr});
}
void RelocationBaseSection::addReloc(const DynamicReloc &reloc) {
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 02941e3dfbbb..8c5d1ae88672 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -534,7 +534,7 @@ class RelocationBaseSection : public SyntheticSection {
uint64_t offsetInSec, Symbol &sym,
RelType addendRelType);
void addReloc(DynamicReloc::Kind kind, RelType dynType,
- InputSectionBase *inputSec, uint64_t offsetInSec, Symbol &sym,
+ InputSectionBase &inputSec, uint64_t offsetInSec, Symbol &sym,
int64_t addend, RelExpr expr, RelType addendRelType);
bool isNeeded() const override { return !relocs.empty(); }
size_t getSize() const override { return relocs.size() * this->entsize; }
More information about the llvm-commits
mailing list