[lld] e7c8cd4 - [ELF] Remove forEachRelSec. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 16 00:28:52 PST 2022
Author: Fangrui Song
Date: 2022-01-16T00:28:47-08:00
New Revision: e7c8cd4a930465edd6c0ecbf3ad3119737988941
URL: https://github.com/llvm/llvm-project/commit/e7c8cd4a930465edd6c0ecbf3ad3119737988941
DIFF: https://github.com/llvm/llvm-project/commit/e7c8cd4a930465edd6c0ecbf3ad3119737988941.diff
LOG: [ELF] Remove forEachRelSec. NFC
Added:
Modified:
lld/ELF/Writer.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4ff3ec5849f1..742ea81fcb57 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -55,7 +55,6 @@ template <class ELFT> class Writer {
private:
void copyLocalSymbols();
void addSectionSymbols();
- void forEachRelSec(llvm::function_ref<void(InputSectionBase &)> fn);
void sortSections();
void resolveShfLinkOrder();
void finalizeAddressDependentContent();
@@ -1031,26 +1030,6 @@ template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
Out::elfHeader, 0, STV_HIDDEN);
}
-template <class ELFT>
-void Writer<ELFT>::forEachRelSec(
- llvm::function_ref<void(InputSectionBase &)> fn) {
- // Scan all relocations. Each relocation goes through a series
- // of tests to determine if it needs special treatment, such as
- // creating GOT, PLT, copy relocations, etc.
- // Note that relocations for non-alloc sections are directly
- // processed by InputSection::relocateNonAlloc.
- for (InputSectionBase *isec : inputSections)
- if (isec->isLive() && isa<InputSection>(isec) && (isec->flags & SHF_ALLOC))
- fn(*isec);
- for (Partition &part : partitions) {
- for (EhInputSection *es : part.ehFrame->sections)
- fn(*es);
- if (part.armExidx && part.armExidx->isLive())
- for (InputSection *ex : part.armExidx->exidxSections)
- fn(*ex);
- }
-}
-
// This function generates assignments for predefined symbols (e.g. _end or
// _etext) and inserts them into the commands sequence to be processed at the
// appropriate time. This ensures that the value is going to be correct by the
@@ -1928,7 +1907,21 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// a linker-script-defined symbol is absolute.
ppc64noTocRelax.clear();
if (!config->relocatable) {
- forEachRelSec(scanRelocations<ELFT>);
+ // Scan all relocations. Each relocation goes through a series of tests to
+ // determine if it needs special treatment, such as creating GOT, PLT,
+ // copy relocations, etc. Note that relocations for non-alloc sections are
+ // directly processed by InputSection::relocateNonAlloc.
+ for (InputSectionBase *sec : inputSections)
+ if (sec->isLive() && isa<InputSection>(sec) && (sec->flags & SHF_ALLOC))
+ scanRelocations<ELFT>(*sec);
+ for (Partition &part : partitions) {
+ for (EhInputSection *sec : part.ehFrame->sections)
+ scanRelocations<ELFT>(*sec);
+ if (part.armExidx && part.armExidx->isLive())
+ for (InputSection *sec : part.armExidx->exidxSections)
+ scanRelocations<ELFT>(*sec);
+ }
+
reportUndefinedSymbols<ELFT>();
postScanRelocations();
}
More information about the llvm-commits
mailing list