Lines Matching +full:segment +full:- +full:no +full:- +full:remap
1 //===- lib/MC/MCContext.cpp - Machine Code Context ------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
77 SaveTempLabels = TargetOptions && TargetOptions->MCSaveTempLabels;
78 SecureLogFile = TargetOptions ? TargetOptions->AsSecureLogFile : "";
80 if (SrcMgr && SrcMgr->getNumBuffers())
81 MainFileName = std::string(SrcMgr->getMemoryBuffer(SrcMgr->getMainFileID())
82 ->getBufferIdentifier());
91 "Cannot initialize MC for non-Windows COFF object files.");
132 //===----------------------------------------------------------------------===//
134 //===----------------------------------------------------------------------===//
191 //===----------------------------------------------------------------------===//
193 //===----------------------------------------------------------------------===//
201 assert(!Sec.curFragList()->Head);
203 F->setParent(&Sec);
204 Sec.curFragList()->Head = F;
205 Sec.curFragList()->Tail = F;
209 //===----------------------------------------------------------------------===//
211 //===----------------------------------------------------------------------===//
221 bool IsRenamable = NameRef.starts_with(MAI->getPrivateGlobalPrefix());
227 assert(IsRenamable && "cannot rename non-private symbol");
238 return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + FuncName +
243 return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + FuncName +
248 return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + "__ehtable$" +
301 while (AlwaysAddSuffix || EntryPtr->second.Used) {
309 EntryPtr->second.Used = true;
316 return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name,
321 return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name, true,
327 return getOrCreateSymbol(MAI->getPrivateLabelPrefix() + Name);
332 return createRenamableSymbol(MAI->getPrivateLabelPrefix() + Name,
341 return createRenamableSymbol(MAI->getLinkerPrivateGlobalPrefix() + Name,
361 return Label->incInstance();
368 return Label->getInstance();
399 if (Sym && Sym->isDefined() &&
400 (!Sym->isInSection() || Sym->getSection().getBeginSymbol() != Sym))
402 if (Sym && Sym->isUndefined()) {
426 InlineAsmUsedLabelNames[Sym->getName()] = Sym;
438 StringRef OriginalName = Name->first();
443 if (MAI->isValidUnquotedName(OriginalName))
461 if (!MAI->isAcceptableChar(InvalidName[I]) || InvalidName[I] == '_') {
470 ValidName.append(InvalidName.substr(1, InvalidName.size() - 1));
481 XSym->setSymbolTableName(MCSymbolXCOFF::getUnqualifiedName(OriginalName));
485 //===----------------------------------------------------------------------===//
487 //===----------------------------------------------------------------------===//
489 MCSectionMachO *MCContext::getMachOSection(StringRef Segment, StringRef Section,
493 // We unique sections by their segment/section pair. The returned section
503 auto R = MachOUniquingMap.try_emplace((Segment + Twine(',') + Section).str());
505 return R.first->second;
512 StringRef Name = R.first->first();
514 MCSectionMachO(Segment, Name.substr(Name.size() - Section.size()),
516 R.first->second = Ret;
528 R->setBinding(ELF::STB_LOCAL);
529 R->setType(ELF::STT_SECTION);
535 R->setFragment(F);
548 I->getKey(), Type, Flags, EntrySize, Group, true, true,
549 cast<MCSymbolELF>(RelInfoSection->getBeginSymbol()));
580 Group = GroupSym->getName();
581 assert(!(LinkedToSym && LinkedToSym->getName().empty()));
585 // combined into one section. As an optimization, non-unique sections without
586 // group or linked-to symbol have a shorter unique-ing key.
596 Buffer.append(GroupSym->getName());
599 Buffer.append(LinkedToSym->getName());
615 return EntryNewPair.first->second;
617 StringRef CachedName = EntryNewPair.first->getKey().take_front(SectionLen);
622 EntryNewPair.first->second = Result;
624 recordELFMergeableSectionInfo(Result->getName(), Result->getFlags(),
625 Result->getUniqueID(), Result->getEntrySize());
647 // For mergeable sections or non-mergeable sections with a generic mergeable
671 return (I != ELFEntrySizeMap.end()) ? std::optional<unsigned>(I->second)
683 return Iter->second;
685 StringRef CachedName = Iter->first;
688 Iter->second = GOFFSection;
700 COMDATSymName = COMDATSymbol->getName();
701 // A non-associative COMDAT is considered to define the COMDAT symbol. Check
704 COMDATSymbol->isDefined() &&
705 (!COMDATSymbol->isInSection() ||
706 cast<MCSectionCOFF>(COMDATSymbol->getSection()).getCOMDATSymbol() !=
716 return Iter->second;
718 StringRef CachedName = Iter->first.SectionName;
722 Iter->second = Result;
724 Begin->setFragment(F);
742 unsigned Characteristics = Sec->getCharacteristics();
745 return getCOFFSection(Sec->getName(), Characteristics, KeySym->getName(),
749 return getCOFFSection(Sec->getName(), Characteristics, "", 0, UniqueID);
758 GroupSym->setComdat(true);
770 Group = GroupSym->getName();
782 getSymbolTableEntry(Begin->getName()).second.Symbol = Begin;
783 cast<MCSymbolWasm>(Begin)->setType(wasm::WASM_SYMBOL_TYPE_SECTION);
790 Begin->setFragment(F);
810 : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
815 if (ExistedEntry->isMultiSymbolsAllowed() != MultiSymbolsAllowed)
830 XCOFF::getMappingClassString(CsectProp->MappingClass) + "]"));
832 // QualName->getUnqualifiedName() and CachedName are the same except when
837 QualName->getUnqualifiedName(), Kind, QualName,
841 MCSectionXCOFF(QualName->getUnqualifiedName(), CsectProp->MappingClass,
842 CsectProp->Type, Kind, QualName, nullptr, CachedName,
854 if (IsDwarfSec || CsectProp->MappingClass == XCOFF::XMC_PR)
855 QualName->setFragment(F);
872 return ItInsertedPair.first->second;
878 StringRef Name = MapIt->first();
879 MapIt->second =
883 allocInitialFragment(*MapIt->second);
884 return MapIt->second;
903 const auto &DebugPrefixMap = this->DebugPrefixMap;
907 // Remap compilation directory.
910 // Remap MCDwarfDirs and RootFile.Name in all compilation units.
927 //===----------------------------------------------------------------------===//
929 //===----------------------------------------------------------------------===//
934 return TargetOptions->EmitDwarfUnwind;
939 return TargetOptions->EmitCompactUnwindNonCanonical;
959 // Or, MainFileName might have been overridden by a -main-file-name option,
960 // which is supposed to be just a base filename with no directory component.
964 if (FileNameBuf.empty() || FileNameBuf == "-")
979 /// getDwarfFile - takes a file name and number to place in the dwarf file and
993 /// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
1018 //===----------------------------------------------------------------------===//
1020 //===----------------------------------------------------------------------===//
1049 // For MC-only execution, only SrcMgr is used;
1050 // For non MC-only execution, InlineSrcMgr is only ctor'd if there is
1070 D = SMP->GetMessage(Loc, SourceMgr::DK_Error, Msg);
1075 if (TargetOptions && TargetOptions->MCNoWarn)
1077 if (TargetOptions && TargetOptions->MCFatalWarnings) {
1081 D = SMP->GetMessage(Loc, SourceMgr::DK_Warning, Msg);