Skip to content

Commit e7c8cd4

Browse files
committed
[ELF] Remove forEachRelSec. NFC
1 parent 9e885ea commit e7c8cd4

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

lld/ELF/Writer.cpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ template <class ELFT> class Writer {
5555
private:
5656
void copyLocalSymbols();
5757
void addSectionSymbols();
58-
void forEachRelSec(llvm::function_ref<void(InputSectionBase &)> fn);
5958
void sortSections();
6059
void resolveShfLinkOrder();
6160
void finalizeAddressDependentContent();
@@ -1031,26 +1030,6 @@ template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
10311030
Out::elfHeader, 0, STV_HIDDEN);
10321031
}
10331032

1034-
template <class ELFT>
1035-
void Writer<ELFT>::forEachRelSec(
1036-
llvm::function_ref<void(InputSectionBase &)> fn) {
1037-
// Scan all relocations. Each relocation goes through a series
1038-
// of tests to determine if it needs special treatment, such as
1039-
// creating GOT, PLT, copy relocations, etc.
1040-
// Note that relocations for non-alloc sections are directly
1041-
// processed by InputSection::relocateNonAlloc.
1042-
for (InputSectionBase *isec : inputSections)
1043-
if (isec->isLive() && isa<InputSection>(isec) && (isec->flags & SHF_ALLOC))
1044-
fn(*isec);
1045-
for (Partition &part : partitions) {
1046-
for (EhInputSection *es : part.ehFrame->sections)
1047-
fn(*es);
1048-
if (part.armExidx && part.armExidx->isLive())
1049-
for (InputSection *ex : part.armExidx->exidxSections)
1050-
fn(*ex);
1051-
}
1052-
}
1053-
10541033
// This function generates assignments for predefined symbols (e.g. _end or
10551034
// _etext) and inserts them into the commands sequence to be processed at the
10561035
// 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() {
19281907
// a linker-script-defined symbol is absolute.
19291908
ppc64noTocRelax.clear();
19301909
if (!config->relocatable) {
1931-
forEachRelSec(scanRelocations<ELFT>);
1910+
// Scan all relocations. Each relocation goes through a series of tests to
1911+
// determine if it needs special treatment, such as creating GOT, PLT,
1912+
// copy relocations, etc. Note that relocations for non-alloc sections are
1913+
// directly processed by InputSection::relocateNonAlloc.
1914+
for (InputSectionBase *sec : inputSections)
1915+
if (sec->isLive() && isa<InputSection>(sec) && (sec->flags & SHF_ALLOC))
1916+
scanRelocations<ELFT>(*sec);
1917+
for (Partition &part : partitions) {
1918+
for (EhInputSection *sec : part.ehFrame->sections)
1919+
scanRelocations<ELFT>(*sec);
1920+
if (part.armExidx && part.armExidx->isLive())
1921+
for (InputSection *sec : part.armExidx->exidxSections)
1922+
scanRelocations<ELFT>(*sec);
1923+
}
1924+
19321925
reportUndefinedSymbols<ELFT>();
19331926
postScanRelocations();
19341927
}

0 commit comments

Comments
 (0)