diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
| -rw-r--r-- | lld/ELF/Writer.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 49a319c643b3..90c8d081b702 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -141,7 +141,7 @@ void elf::copySectionsIntoPartitions() { static Defined *addOptionalRegular(StringRef name, SectionBase *sec, uint64_t val, uint8_t stOther = STV_HIDDEN) { - Symbol *s = symtab.find(name); + Symbol *s = ctx.symtab->find(name); if (!s || s->isDefined() || s->isCommon()) return nullptr; @@ -158,8 +158,8 @@ void elf::addReservedSymbols() { if (ctx.arg.emachine == EM_MIPS) { auto addAbsolute = [](StringRef name) { Symbol *sym = - symtab.addSymbol(Defined{ctx.internalFile, name, STB_GLOBAL, - STV_HIDDEN, STT_NOTYPE, 0, 0, nullptr}); + ctx.symtab->addSymbol(Defined{ctx.internalFile, name, STB_GLOBAL, + STV_HIDDEN, STT_NOTYPE, 0, 0, nullptr}); sym->isUsedInRegularObj = true; return cast<Defined>(sym); }; @@ -172,14 +172,14 @@ void elf::addReservedSymbols() { // On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between // start of function and 'gp' pointer into GOT. - if (symtab.find("_gp_disp")) + if (ctx.symtab->find("_gp_disp")) ctx.sym.mipsGpDisp = addAbsolute("_gp_disp"); // The __gnu_local_gp is a magic symbol equal to the current value of 'gp' // pointer. This symbol is used in the code generated by .cpload pseudo-op // in case of using -mno-shared option. // https://sourceware.org/ml/binutils/2004-12/msg00094.html - if (symtab.find("__gnu_local_gp")) + if (ctx.symtab->find("__gnu_local_gp")) ctx.sym.mipsLocalGp = addAbsolute("__gnu_local_gp"); } else if (ctx.arg.emachine == EM_PPC) { // glibc *crt1.o has a undefined reference to _SDA_BASE_. Since we don't @@ -200,7 +200,7 @@ void elf::addReservedSymbols() { StringRef gotSymName = (ctx.arg.emachine == EM_PPC64) ? ".TOC." : "_GLOBAL_OFFSET_TABLE_"; - if (Symbol *s = symtab.find(gotSymName)) { + if (Symbol *s = ctx.symtab->find(gotSymName)) { if (s->isDefined()) { error(toString(s->file) + " cannot redefine linker defined symbol '" + gotSymName + "'"); @@ -273,7 +273,7 @@ static void demoteDefined(Defined &sym, DenseMap<SectionBase *, size_t> &map) { static void demoteSymbolsAndComputeIsPreemptible() { llvm::TimeTraceScope timeScope("Demote symbols"); DenseMap<InputFile *, DenseMap<SectionBase *, size_t>> sectionIndexMap; - for (Symbol *sym : symtab.getSymbols()) { + for (Symbol *sym : ctx.symtab->getSymbols()) { if (auto *d = dyn_cast<Defined>(sym)) { if (d->section && !d->section->isLive()) demoteDefined(*d, sectionIndexMap[d->file]); @@ -1106,7 +1106,7 @@ static DenseMap<const InputSectionBase *, int> buildSectionOrder() { // We want both global and local symbols. We get the global ones from the // symbol table and iterate the object files for the local ones. - for (Symbol *sym : symtab.getSymbols()) + for (Symbol *sym : ctx.symtab->getSymbols()) addSym(*sym); for (ELFFileBase *file : ctx.objectFiles) @@ -1724,7 +1724,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { // Even the author of gold doesn't remember why gold behaves that way. // https://sourceware.org/ml/binutils/2002-03/msg00360.html if (ctx.mainPart->dynamic->parent) { - Symbol *s = symtab.addSymbol(Defined{ + Symbol *s = ctx.symtab->addSymbol(Defined{ ctx.internalFile, "_DYNAMIC", STB_WEAK, STV_HIDDEN, STT_NOTYPE, /*value=*/0, /*size=*/0, ctx.mainPart->dynamic.get()}); s->isUsedInRegularObj = true; @@ -1745,7 +1745,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { // Set riscvGlobalPointer to be used by the optional global pointer // relaxation. if (ctx.arg.relaxGP) { - Symbol *s = symtab.find("__global_pointer$"); + Symbol *s = ctx.symtab->find("__global_pointer$"); if (s && s->isDefined()) ctx.sym.riscvGlobalPointer = cast<Defined>(s); } @@ -1764,7 +1764,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { // 2) is special cased in @tpoff computation. To satisfy 1), we define it // as an absolute symbol of zero. This is different from GNU linkers which // define _TLS_MODULE_BASE_ relative to the first TLS section. - Symbol *s = symtab.find("_TLS_MODULE_BASE_"); + Symbol *s = ctx.symtab->find("_TLS_MODULE_BASE_"); if (s && s->isUndefined()) { s->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL, STV_HIDDEN, STT_TLS, /*value=*/0, 0, @@ -1832,7 +1832,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { for (SharedFile *file : ctx.sharedFiles) { bool allNeededIsKnown = llvm::all_of(file->dtNeeded, [&](StringRef needed) { - return symtab.soNames.count(CachedHashStringRef(needed)); + return ctx.symtab->soNames.count(CachedHashStringRef(needed)); }); if (!allNeededIsKnown) continue; @@ -1857,7 +1857,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { llvm::TimeTraceScope timeScope("Add symbols to symtabs"); // Now that we have defined all possible global symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. - for (Symbol *sym : symtab.getSymbols()) { + for (Symbol *sym : ctx.symtab->getSymbols()) { if (!sym->isUsedInRegularObj || !includeInSymtab(*sym)) continue; if (!ctx.arg.relocatable) @@ -1922,8 +1922,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { if (ctx.arg.emachine == EM_HEXAGON && hexagonNeedsTLSSymbol(ctx.outputSections)) { Symbol *sym = - symtab.addSymbol(Undefined{ctx.internalFile, "__tls_get_addr", - STB_GLOBAL, STV_DEFAULT, STT_NOTYPE}); + ctx.symtab->addSymbol(Undefined{ctx.internalFile, "__tls_get_addr", + STB_GLOBAL, STV_DEFAULT, STT_NOTYPE}); sym->isPreemptible = true; ctx.partitions[0].dynSymTab->addSymbol(sym); } @@ -2701,7 +2701,7 @@ template <class ELFT> void Writer<ELFT>::checkSections() { // 5. the address 0. static uint64_t getEntryAddr() { // Case 1, 2 or 3 - if (Symbol *b = symtab.find(ctx.arg.entry)) + if (Symbol *b = ctx.symtab->find(ctx.arg.entry)) return b->getVA(); // Case 4 |
