Lines Matching +full:imp +full:- +full:res +full:- +full:offset +full:- +full:value
1 //===- SymbolTable.cpp ----------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
54 if (file->lazy) { in addFile()
56 f->parseLazy(); in addFile()
58 cast<ObjFile>(file)->parseLazy(); in addFile()
60 file->parse(); in addFile()
74 MachineTypes mt = file->getMachineType(); in addFile()
96 s->pendingArchiveLoad = true; in forceLazy()
97 switch (s->kind()) { in forceLazy()
100 l->file->addMember(l->sym); in forceLazy()
104 InputFile *file = cast<LazyObject>(s)->file; in forceLazy()
105 file->ctx.symtab.addFile(file); in forceLazy()
110 l->file->makeImport(l->sym); in forceLazy()
119 // Returns the symbol in SC whose value is <= Addr that is closest to Addr.
125 for (Symbol *s : sc->file->getSymbols()) { in getSymbol()
127 if (!d || !d->data || d->file != sc->file || d->getChunk() != sc || in getSymbol()
128 d->getValue() > addr || in getSymbol()
129 (candidate && d->getValue() < candidate->getValue())) in getSymbol()
139 std::string res("\n>>> referenced by "); in getSymbolLocations() local
140 StringRef source = file->obj->getSourceFileName(); in getSymbolLocations()
142 res += source.str() + "\n>>> "; in getSymbolLocations()
143 res += toString(file); in getSymbolLocations()
144 return {res}; in getSymbolLocations()
150 c->file->getDILineInfo(addr, c->getSectionNumber() - 1); in getFileLineDwarf()
165 if (!fileLine && c->file->ctx.config.mingw) in getFileLine()
185 for (Chunk *c : file->getChunks()) { in getSymbolLocations()
189 for (const coff_relocation &r : sc->getRelocs()) { in getSymbolLocations()
223 os << ":(" << toString(file->ctx, *loc.sym) << ')'; in getSymbolLocations()
268 ref.file, ref.symIndex, maxUndefReferences - numDisplayedRefs); in reportUndefinedSymbol()
277 os << "\n>>> referenced " << numRefs - numDisplayedRefs << " more times"; in reportUndefinedSymbol()
287 if (undef->getWeakAlias()) in loadMinGWSymbols()
290 StringRef name = undef->getName(); in loadMinGWSymbols()
306 if (l->isLazy() && !l->pendingArchiveLoad) { in loadMinGWSymbols()
307 log("Loading lazy " + l->getName() + " from " + in loadMinGWSymbols()
308 l->getFile()->getName() + " for stdcall fixup"); in loadMinGWSymbols()
312 if (l->isLazy() || isa<Defined>(l)) { in loadMinGWSymbols()
317 undef->weakAlias = l; in loadMinGWSymbols()
329 if (!l || l->pendingArchiveLoad || !l->isLazy()) in loadMinGWSymbols()
332 log("Loading lazy " + l->getName() + " from " + l->getFile()->getName() + in loadMinGWSymbols()
346 Defined *imp = impSymbol(name); in handleMinGWAutomaticImport() local
347 if (!imp) in handleMinGWAutomaticImport()
357 if (isa<DefinedImportData>(imp)) { in handleMinGWAutomaticImport()
359 cast<DefinedImportData>(imp)->getDLLName()); in handleMinGWAutomaticImport()
361 } else if (isa<DefinedRegular>(imp)) { in handleMinGWAutomaticImport()
363 toString(cast<DefinedRegular>(imp)->file)); in handleMinGWAutomaticImport()
366 warn("unable to automatically import " + name + " from " + imp->getName() + in handleMinGWAutomaticImport()
367 " from " + toString(cast<DefinedRegular>(imp)->file) + in handleMinGWAutomaticImport()
371 sym->replaceKeepingName(imp, impSize); in handleMinGWAutomaticImport()
372 sym->isRuntimePseudoReloc = true; in handleMinGWAutomaticImport()
381 if (refptr && refptr->getChunk()->getSize() == ctx.config.wordsize) { in handleMinGWAutomaticImport()
382 SectionChunk *sc = dyn_cast_or_null<SectionChunk>(refptr->getChunk()); in handleMinGWAutomaticImport()
383 if (sc && sc->getRelocs().size() == 1 && *sc->symbols().begin() == sym) { in handleMinGWAutomaticImport()
384 log("Replacing .refptr." + name + " with " + imp->getName()); in handleMinGWAutomaticImport()
385 refptr->getChunk()->live = false; in handleMinGWAutomaticImport()
386 refptr->replaceKeepingName(imp, impSize); in handleMinGWAutomaticImport()
403 if (undefs.empty() && (!localImports || localImports->empty())) in reportProblemSymbols()
411 if (Symbol *imp = localImports->lookup(b)) in reportProblemSymbols() local
412 warn("<root>: locally defined symbol imported: " + toString(ctx, *imp) + in reportProblemSymbols()
413 " (defined in " + toString(imp->getFile()) + ") [LNK4217]"); in reportProblemSymbols()
420 uint32_t symIndex = (uint32_t)-1; in reportProblemSymbols()
431 undefDiags[it->second].files.push_back({file, symIndex}); in reportProblemSymbols()
435 if (Symbol *imp = localImports->lookup(sym)) in reportProblemSymbols() local
437 ": locally defined symbol imported: " + toString(ctx, *imp) + in reportProblemSymbols()
438 " (defined in " + toString(imp->getFile()) + ") [LNK4217]"); in reportProblemSymbols()
443 processFile(file, file->getSymbols()); in reportProblemSymbols()
447 processFile(file, file->getSymbols()); in reportProblemSymbols()
458 if (!undef || sym->deferUndefined) in reportUnresolvable()
460 if (undef->getWeakAlias()) in reportUnresolvable()
462 StringRef name = undef->getName(); in reportUnresolvable()
464 Symbol *imp = find(name.substr(strlen("__imp_"))); in reportUnresolvable() local
465 if (Defined *def = dyn_cast_or_null<Defined>(imp)) { in reportUnresolvable()
466 def->isUsedInRegularObj = true; in reportUnresolvable()
491 if (!sym->isUsedInRegularObj) in resolveRemainingUndefines()
494 StringRef name = undef->getName(); in resolveRemainingUndefines()
497 if (Defined *d = undef->getWeakAlias()) { in resolveRemainingUndefines()
515 Symbol *imp = find(name.substr(strlen("__imp_"))); in resolveRemainingUndefines() local
516 if (imp && isa<Defined>(imp)) { in resolveRemainingUndefines()
517 auto *d = cast<Defined>(imp); in resolveRemainingUndefines()
519 localImportChunks.push_back(cast<DefinedLocalImport>(sym)->getChunk()); in resolveRemainingUndefines()
550 sym->isUsedInRegularObj = false; in insert()
551 sym->pendingArchiveLoad = false; in insert()
552 sym->canInline = true; in insert()
561 result.first->isUsedInRegularObj = true; in insert()
576 // offset to its entry thunks. To ensure that padding the function is in initializeEntryThunks()
577 // feasible, functions are required to be COMDAT symbols with no offset. in initializeEntryThunks()
578 if (!from || !from->getChunk()->isCOMDAT() || in initializeEntryThunks()
579 cast<DefinedRegular>(from)->getValue()) { in initializeEntryThunks()
580 error("non COMDAT symbol '" + from->getName() + "' in hybrid map"); in initializeEntryThunks()
583 from->getChunk()->setEntryThunk(to); in initializeEntryThunks()
590 if (wasInserted || (s->isLazy() && isWeakAlias)) { in addUndefined()
594 if (s->isLazy()) in addUndefined()
607 if (!u || u->weakAlias || s->pendingArchiveLoad) in addLazyArchive()
609 s->pendingArchiveLoad = true; in addLazyArchive()
610 f->addMember(sym); in addLazyArchive()
614 assert(f->lazy); in addLazyObject()
621 if (!u || u->weakAlias || s->pendingArchiveLoad) in addLazyObject()
623 s->pendingArchiveLoad = true; in addLazyObject()
624 f->lazy = false; in addLazyObject()
636 if (!u || u->weakAlias || s->pendingArchiveLoad) in addLazyDLLSymbol()
638 s->pendingArchiveLoad = true; in addLazyDLLSymbol()
639 f->makeImport(sym); in addLazyDLLSymbol()
643 std::string res("\n>>> defined at "); in getSourceLocationBitcode() local
644 StringRef source = file->obj->getSourceFileName(); in getSourceLocationBitcode()
646 res += source.str() + "\n>>> "; in getSourceLocationBitcode()
647 res += toString(file); in getSourceLocationBitcode()
648 return res; in getSourceLocationBitcode()
652 uint32_t offset, StringRef name) { in getSourceLocationObj() argument
655 fileLine = getFileLine(sc, offset); in getSourceLocationObj()
657 fileLine = file->getVariableLocation(name); in getSourceLocationObj()
659 std::string res; in getSourceLocationObj() local
660 llvm::raw_string_ostream os(res); in getSourceLocationObj()
663 os << fileLine->first << ":" << fileLine->second << "\n>>> "; in getSourceLocationObj()
669 uint32_t offset, StringRef name) { in getSourceLocation() argument
673 return getSourceLocationObj(o, sc, offset, name); in getSourceLocation()
681 // lld-link: error: duplicate symbol: foo
694 if (d && isa<ObjFile>(d->getFile())) { in reportDuplicate()
695 os << getSourceLocation(d->getFile(), d->getChunk(), d->getValue(), in reportDuplicate()
696 existing->getName()); in reportDuplicate()
698 os << getSourceLocation(existing->getFile(), nullptr, 0, ""); in reportDuplicate()
701 existing->getName()); in reportDuplicate()
711 s->isUsedInRegularObj = true; in addAbsolute()
712 if (wasInserted || isa<Undefined>(s) || s->isLazy()) in addAbsolute()
715 if (da->getVA() != sym.getValue()) in addAbsolute()
724 s->isUsedInRegularObj = true; in addAbsolute()
725 if (wasInserted || isa<Undefined>(s) || s->isLazy()) in addAbsolute()
728 if (da->getVA() != va) in addAbsolute()
737 s->isUsedInRegularObj = true; in addSynthetic()
738 if (wasInserted || isa<Undefined>(s) || s->isLazy()) in addSynthetic()
749 if (wasInserted || !isa<DefinedRegular>(s) || s->isWeak) in addRegular()
767 if (!existingSymbol->isCOMDAT) in addComdat()
778 if (size > dc->getSize()) in addCommon()
785 s->isUsedInRegularObj = true; in addImportData()
786 if (wasInserted || isa<Undefined>(s) || s->isLazy()) { in addImportData()
798 s->isUsedInRegularObj = true; in addImportThunk()
799 if (wasInserted || isa<Undefined>(s) || s->isLazy()) { in addImportThunk()
804 reportDuplicate(s, id->file); in addImportThunk()
814 MemoryBufferRef mb = l->getMemberBuffer(); in addLibcall()
816 addUndefined(sym->getName()); in addLibcall()
818 if (isBitcode(o->file->mb)) in addLibcall()
819 addUndefined(sym->getName()); in addLibcall()
824 std::vector<Chunk *> res; in getChunks() local
826 ArrayRef<Chunk *> v = file->getChunks(); in getChunks()
827 res.insert(res.end(), v.begin(), v.end()); in getChunks()
829 return res; in getChunks()
863 if (Symbol *weakAlias = u->getWeakAlias()) in findMangle()
875 auto findByPrefix = [&syms](const Twine &t) -> Symbol * { in findMangle()
878 if (s->getName().starts_with(prefix)) in findMangle()
883 // For non-x86, just look for C++ functions. in findMangle()
898 // Search for x86 C++ non-member function. in findMangle()
915 lto->add(*f); in compileBitcodeFiles()
916 for (InputFile *newObj : lto->compile()) { in compileBitcodeFiles()
918 obj->parse(); in compileBitcodeFiles()