Lines Matching full:symbol
109 // Used with .file symbol
230 // Create jitlink symbol
231 jitlink::Symbol *GSym = nullptr;
234 dbgs() << " " << SymIndex << ": Skipping FileRecord symbol \""
248 Expected<jitlink::Symbol *> NewGSym =
256 << ": Creating defined graph symbol for COFF symbol \""
265 // Register the symbol
343 << ": Creating weak external symbol for COFF symbol \""
349 return make_error<JITLinkError>("Weak symbol alias requested but actual "
350 "symbol not found for symbol " +
368 Symbol *COFFLinkGraphBuilder::createExternalSymbol(
370 object::COFFSymbolRef Symbol, const object::coff_section *Section) {
373 &G->addExternalSymbol(SymbolName, Symbol.getValue(), false);
377 << ": Creating external graph symbol for COFF symbol \""
379 << getCOFFSectionName(Symbol.getSectionNumber(), Section, Symbol)
380 << " (index: " << Symbol.getSectionNumber() << ") \n";
385 Expected<Symbol *> COFFLinkGraphBuilder::createAliasSymbol(StringRef SymbolName,
387 Symbol &Target) {
390 return make_error<JITLinkError>("Weak external symbol with external "
391 "symbol as alternative not supported.");
399 // Hence, we calculate the "implicit" size of symbol by taking the delta of
402 // logarithmic time complexity of sorted symbol insertion. Symbol is inserted to
404 // each collected symbol in sorted order and calculate the implicit size.
418 jitlink::Symbol *Symbol = It->second;
421 if (Symbol->getOffset() == LastOffset)
427 if (Offset + Symbol->getSize() > LastDifferentOffset)
428 dbgs() << " Overlapping symbol range generated for the following "
429 "symbol:"
431 << " " << *Symbol << "\n";
438 if (Symbol->getSize()) {
439 // Non empty symbol can happen in COMDAT symbol.
440 // We don't consider the possibility of overlapping symbol range that
441 // could be introduced by disparity between inferred symbol size and
442 // defined symbol size because symbol size information is currently only
450 dbgs() << " Empty implicit symbol size generated for the following "
451 "symbol:"
453 << " " << *Symbol << "\n";
456 Symbol->setSize(CandSize);
462 Expected<Symbol *> COFFLinkGraphBuilder::createDefinedSymbol(
464 object::COFFSymbolRef Symbol, const object::coff_section *Section) {
465 if (Symbol.isCommon()) {
468 G->createZeroFillBlock(getCommonSection(), Symbol.getValue(),
469 orc::ExecutorAddr(), Symbol.getValue(), 0),
470 0, SymbolName, Symbol.getValue(), Linkage::Strong, Scope::Default,
473 if (Symbol.isAbsolute())
475 orc::ExecutorAddr(Symbol.getValue()), 0,
478 if (llvm::COFF::isReservedSectionNumber(Symbol.getSectionNumber()))
480 "Reserved section number used in regular symbol " +
483 Block *B = getGraphBlock(Symbol.getSectionNumber());
487 << ": Skipping graph symbol since section was not created for "
488 "COFF symbol \""
489 << SymbolName << "\" in section " << Symbol.getSectionNumber()
495 if (Symbol.isExternal()) {
496 // This is not a comdat sequence, export the symbol as it is
499 *B, Symbol.getValue(), SymbolName, 0, Linkage::Strong, Scope::Default,
500 Symbol.getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION, false);
504 if (!PendingComdatExports[Symbol.getSectionNumber()])
505 return make_error<JITLinkError>("No pending COMDAT export for symbol " +
508 return exportCOMDATSymbol(SymIndex, SymbolName, Symbol);
512 if (Symbol.getStorageClass() == COFF::IMAGE_SYM_CLASS_STATIC ||
513 Symbol.getStorageClass() == COFF::IMAGE_SYM_CLASS_LABEL) {
515 Symbol.getSectionDefinition();
517 // Handle typical static symbol
519 *B, Symbol.getValue(), SymbolName, 0, Linkage::Strong, Scope::Local,
520 Symbol.getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION, false);
523 auto Target = Definition->getNumber(Symbol.isBigObj());
525 *B, Symbol.getValue(), SymbolName, 0, Linkage::Strong, Scope::Local,
526 Symbol.getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION, false);
530 if (PendingComdatExports[Symbol.getSectionNumber()])
532 "COMDAT export request already exists before symbol " +
534 return createCOMDATExportRequest(SymIndex, Symbol, Definition);
537 formatv("{0:d}", Symbol.getStorageClass()) +
538 " in symbol " + formatv("{0:d}", SymIndex));
544 // in a sequence that specifes the behavior. First symbol is the section
545 // symbol which contains the size and name of the section. It also contains
546 // selection type that specifies how duplicate of the symbol is handled.
547 // Second symbol is COMDAT symbol which usually defines the external name and
551 // export request when we encounter the first symbol and actually exports it
552 // when we process the second symbol.
554 // Process the first symbol of COMDAT sequence.
555 Expected<Symbol *> COFFLinkGraphBuilder::createCOMDATExportRequest(
556 COFFSymbolIndex SymIndex, object::COFFSymbolRef Symbol,
582 << Symbol.getSectionNumber() << " (size: " << Definition->Length
598 PendingComdatExports[Symbol.getSectionNumber()] = {SymIndex, L,
603 // Process the second symbol of COMDAT sequence.
604 Expected<Symbol *>
607 object::COFFSymbolRef Symbol) {
608 Block *B = getGraphBlock(Symbol.getSectionNumber());
609 auto &PendingComdatExport = PendingComdatExports[Symbol.getSectionNumber()];
610 // NOTE: ComdatDef->Length is the size of "section" not size of symbol.
611 // We use zero symbol size to not reach out of bound of block when symbol
614 *B, Symbol.getValue(), SymbolName, 0, PendingComdatExport->Linkage,
615 Scope::Default, Symbol.getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION,
619 << ": Exporting COMDAT graph symbol for COFF symbol \"" << SymbolName
620 << "\" in section " << Symbol.getSectionNumber() << "\n";
623 setGraphSymbol(Symbol.getSectionNumber(), PendingComdatExport->SymbolIndex,