llvm::TimeTraceScope timeScope("Demote shared and lazy symbols");
for (Symbol *sym : symtab->symbols()) {
auto *s = dyn_cast<SharedSymbol>(sym);
- if (!(s && !s->getFile().isNeeded) && !sym->isLazy())
+ if (!(s && !cast<SharedFile>(s->file)->isNeeded) && !sym->isLazy())
continue;
bool used = sym->used;
if (auto *ss = dyn_cast<SharedSymbol>(&sym))
if (!ss->isWeak())
- ss->getFile().isNeeded = true;
+ cast<SharedFile>(ss->file)->isNeeded = true;
for (InputSectionBase *sec : cNamedSections.lookup(sym.getName()))
enqueue(sec, 0);
for (Symbol *sym : symtab->symbols())
if (auto *s = dyn_cast<SharedSymbol>(sym))
if (s->isUsedInRegularObj && !s->isWeak())
- s->getFile().isNeeded = true;
+ cast<SharedFile>(s->file)->isNeeded = true;
return;
}
using Elf_Phdr = typename ELFT::Phdr;
// Determine if the symbol is read-only by scanning the DSO's program headers.
- const SharedFile &file = ss.getFile();
+ const auto &file = cast<SharedFile>(*ss.file);
for (const Elf_Phdr &phdr :
check(file.template getObj<ELFT>().program_headers()))
if ((phdr.p_type == ELF::PT_LOAD || phdr.p_type == ELF::PT_GNU_RELRO) &&
static SmallSet<SharedSymbol *, 4> getSymbolsAt(SharedSymbol &ss) {
using Elf_Sym = typename ELFT::Sym;
- SharedFile &file = ss.getFile();
+ const auto &file = cast<SharedFile>(*ss.file);
SmallSet<SharedSymbol *, 4> ret;
for (const Elf_Sym &s : file.template getGlobalELFSyms<ELFT>()) {
}
static void addCopyRelSymbol(SharedSymbol &ss) {
- const SharedFile &file = ss.getFile();
+ const auto &file = cast<SharedFile>(*ss.file);
switch (file.ekind) {
case ELF32LEKind:
addCopyRelSymbolImpl<ELF32LE>(ss);
this->type = llvm::ELF::STT_FUNC;
}
- SharedFile &getFile() const { return *cast<SharedFile>(file); }
-
uint64_t value; // st_value
uint64_t size; // st_size
uint32_t alignment;