[ELF] Simplify Symbol::includeInDynsym

This commit is contained in:
Fangrui Song 2022-01-15 23:27:45 -08:00
parent 3736d0854a
commit 7330fd236e
3 changed files with 6 additions and 6 deletions

View File

@ -461,8 +461,9 @@ template <class ELFT> void ICF<ELFT>::run() {
// Compute isPreemptible early. We may add more symbols later, so this loop
// cannot be merged with the later computeIsPreemptible() pass which is used
// by scanRelocations().
for (Symbol *sym : symtab->symbols())
sym->isPreemptible = computeIsPreemptible(*sym);
if (config->hasDynSymTab)
for (Symbol *sym : symtab->symbols())
sym->isPreemptible = computeIsPreemptible(*sym);
// Two text sections may have identical content and relocations but different
// LSDA, e.g. the two functions may have catch blocks of different types. If a

View File

@ -279,8 +279,6 @@ uint8_t Symbol::computeBinding() const {
}
bool Symbol::includeInDynsym() const {
if (!config->hasDynSymTab)
return false;
if (computeBinding() == STB_LOCAL)
return false;
if (!isDefined() && !isCommon())

View File

@ -1912,8 +1912,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
finalizeSynthetic(part.ehFrame.get());
}
for (Symbol *sym : symtab->symbols())
sym->isPreemptible = computeIsPreemptible(*sym);
if (config->hasDynSymTab)
for (Symbol *sym : symtab->symbols())
sym->isPreemptible = computeIsPreemptible(*sym);
// Change values of linker-script-defined symbols from placeholders (assigned
// by declareSymbols) to actual definitions.