Changeset View
Changeset View
Standalone View
Standalone View
lld/ELF/LTO.cpp
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | for (size_t i = 0, e = syms.size(); i != e; ++i) { | ||||
// be removed. | // be removed. | ||||
r.Prevailing = !objSym.isUndefined() && sym->file == &f; | r.Prevailing = !objSym.isUndefined() && sym->file == &f; | ||||
// We ask LTO to preserve following global symbols: | // We ask LTO to preserve following global symbols: | ||||
// 1) All symbols when doing relocatable link, so that them can be used | // 1) All symbols when doing relocatable link, so that them can be used | ||||
// for doing final link. | // for doing final link. | ||||
// 2) Symbols that are used in regular objects. | // 2) Symbols that are used in regular objects. | ||||
// 3) C named sections if we have corresponding __start_/__stop_ symbol. | // 3) C named sections if we have corresponding __start_/__stop_ symbol. | ||||
// 4) Symbols that are defined in bitcode files and used for dynamic linking. | // 4) Symbols that are defined in bitcode files and used for dynamic | ||||
// linking. | |||||
// 5) Symbols that will be referenced after linker wrapping is performed. | |||||
r.VisibleToRegularObj = config->relocatable || sym->isUsedInRegularObj || | r.VisibleToRegularObj = config->relocatable || sym->isUsedInRegularObj || | ||||
sym->referencedAfterWrap || | |||||
(r.Prevailing && sym->includeInDynsym()) || | (r.Prevailing && sym->includeInDynsym()) || | ||||
usedStartStop.count(objSym.getSectionName()); | usedStartStop.count(objSym.getSectionName()); | ||||
// Identify symbols exported dynamically, and that therefore could be | // Identify symbols exported dynamically, and that therefore could be | ||||
// referenced by a shared library not visible to the linker. | // referenced by a shared library not visible to the linker. | ||||
r.ExportDynamic = | r.ExportDynamic = | ||||
sym->computeBinding() != STB_LOCAL && | sym->computeBinding() != STB_LOCAL && | ||||
(config->exportDynamic || sym->exportDynamic || sym->inDynamicList); | (config->exportDynamic || sym->exportDynamic || sym->inDynamicList); | ||||
const auto *dr = dyn_cast<Defined>(sym); | const auto *dr = dyn_cast<Defined>(sym); | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |