Skip to content

Commit 7330fd2

Browse files
committed
[ELF] Simplify Symbol::includeInDynsym
1 parent 3736d08 commit 7330fd2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lld/ELF/ICF.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ template <class ELFT> void ICF<ELFT>::run() {
461461
// Compute isPreemptible early. We may add more symbols later, so this loop
462462
// cannot be merged with the later computeIsPreemptible() pass which is used
463463
// by scanRelocations().
464-
for (Symbol *sym : symtab->symbols())
465-
sym->isPreemptible = computeIsPreemptible(*sym);
464+
if (config->hasDynSymTab)
465+
for (Symbol *sym : symtab->symbols())
466+
sym->isPreemptible = computeIsPreemptible(*sym);
466467

467468
// Two text sections may have identical content and relocations but different
468469
// LSDA, e.g. the two functions may have catch blocks of different types. If a

lld/ELF/Symbols.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ uint8_t Symbol::computeBinding() const {
279279
}
280280

281281
bool Symbol::includeInDynsym() const {
282-
if (!config->hasDynSymTab)
283-
return false;
284282
if (computeBinding() == STB_LOCAL)
285283
return false;
286284
if (!isDefined() && !isCommon())

lld/ELF/Writer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,8 +1912,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
19121912
finalizeSynthetic(part.ehFrame.get());
19131913
}
19141914

1915-
for (Symbol *sym : symtab->symbols())
1916-
sym->isPreemptible = computeIsPreemptible(*sym);
1915+
if (config->hasDynSymTab)
1916+
for (Symbol *sym : symtab->symbols())
1917+
sym->isPreemptible = computeIsPreemptible(*sym);
19171918

19181919
// Change values of linker-script-defined symbols from placeholders (assigned
19191920
// by declareSymbols) to actual definitions.

0 commit comments

Comments
 (0)