Lines Matching defs:sym
52 std::string elf::toStr(Ctx &ctx, const elf::Symbol &sym) {
53 StringRef name = sym.getName();
56 const char *suffix = sym.getVersionSuffix();
63 const Symbol *sym) {
64 return s << toStr(s.ctx, *sym);
67 static uint64_t getSymVA(Ctx &ctx, const Symbol &sym, int64_t addend) {
68 switch (sym.kind()) {
70 auto &d = cast<Defined>(sym);
119 ((sym.stOther & STO_MIPS_MICROMIPS) || sym.hasFlag(NEEDS_COPY)))
282 void elf::printTraceSymbol(const Symbol &sym, StringRef name) {
284 if (sym.isUndefined())
286 else if (sym.isLazy())
288 else if (sym.isShared())
290 else if (sym.isCommon())
295 Msg(sym.file->ctx) << sym.file << s << name;
299 const InputFile &extracted, const Symbol &sym) {
300 ctx.whyExtractRecords.emplace_back(toStr(ctx, reference), &extracted, sym);
303 void elf::maybeWarnUnorderableSymbol(Ctx &ctx, const Symbol *sym) {
313 if (sym->isUndefined() && !cast<Undefined>(sym)->discardedSecIdx &&
317 const InputFile *file = sym->file;
318 auto *d = dyn_cast<Defined>(sym);
320 auto report = [&](StringRef s) { Warn(ctx) << file << s << sym->getName(); };
322 if (sym->isUndefined()) {
323 if (cast<Undefined>(sym)->discardedSecIdx)
327 } else if (sym->isShared())
339 bool elf::computeIsPreemptible(Ctx &ctx, const Symbol &sym) {
340 assert(!sym.isLocal() || sym.isPlaceholder());
344 if (sym.visibility() != STV_DEFAULT)
349 if (!sym.isDefined())
361 sym.binding != STB_WEAK) ||
362 (ctx.arg.bsymbolic == BsymbolicKind::Functions && sym.isFunc()) ||
363 (ctx.arg.bsymbolic == BsymbolicKind::NonWeakFunctions && sym.isFunc() &&
364 sym.binding != STB_WEAK))
365 return sym.inDynamicList;
374 for (Symbol *sym : ctx.symtab->getSymbols()) {
375 if (sym->hasVersionSuffix)
376 sym->parseSymbolVersion(ctx);
378 sym->isExported = sym->includeInDynsym(ctx);
379 sym->isPreemptible = sym->isExported && computeIsPreemptible(ctx, *sym);
527 void elf::reportDuplicate(Ctx &ctx, const Symbol &sym, const InputFile *newFile,
534 const Defined *d = dyn_cast<Defined>(&sym);
541 Err(ctx) << "duplicate symbol: " << &sym << "\n>>> defined in " << sym.file
555 diag << "duplicate symbol: " << &sym << "\n>>> defined at ";
557 diag << sec1->getSrcMsg(sym, d->value);
562 diag << errSec->getSrcMsg(sym, errOffset);
679 void Defined::overwrite(Symbol &sym) const {
680 if (isa_and_nonnull<SharedFile>(sym.file))
681 sym.versionId = VER_NDX_GLOBAL;
682 Symbol::overwrite(sym, DefinedKind);
683 auto &s = static_cast<Defined &>(sym);