Lines Matching +full:on +full:- +full:the +full:- +full:go
1 //===- llvm/CodeGen/TargetLoweringObjectFileImpl.cpp - Object File Info ---===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
76 "jumptable-in-function-section", cl::Hidden, cl::init(false),
89 StringRef Key = MFE.Key->getString(); in GetObjCImageInfo()
90 if (Key == "Objective-C Image Info Version") { in GetObjCImageInfo()
91 Version = mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue(); in GetObjCImageInfo()
92 } else if (Key == "Objective-C Garbage Collection" || in GetObjCImageInfo()
93 Key == "Objective-C GC Only" || in GetObjCImageInfo()
94 Key == "Objective-C Is Simulated" || in GetObjCImageInfo()
95 Key == "Objective-C Class Properties" || in GetObjCImageInfo()
96 Key == "Objective-C Image Swift Version") { in GetObjCImageInfo()
97 Flags |= mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue(); in GetObjCImageInfo()
98 } else if (Key == "Objective-C Image Info Section") { in GetObjCImageInfo()
99 Section = cast<MDString>(MFE.Val)->getString(); in GetObjCImageInfo()
102 // "Objective-C Garbage Collection". in GetObjCImageInfo()
104 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 8; in GetObjCImageInfo()
106 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 24; in GetObjCImageInfo()
108 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 16; in GetObjCImageInfo()
113 //===----------------------------------------------------------------------===//
115 //===----------------------------------------------------------------------===//
133 if (Ctx.getAsmInfo()->getExceptionHandlingType() == ExceptionHandling::ARM) in Initialize()
187 // The small model guarantees static code/data size < 4GB, but not where it in Initialize()
189 // pc-relative 32-bit address is insufficient, theoretically. in Initialize()
191 // Use DW_EH_PE_indirect even for -fno-pic to avoid copy relocations. in Initialize()
209 // that the eh_frame section can be read-only. DW.ref.personality will be in Initialize()
212 // FIXME: The N64 ABI probably ought to use DW_EH_PE_sdata8 but we can't in Initialize()
217 // FreeBSD must be explicit about the data size and using pcrel since it's in Initialize()
218 // assembler/linker won't do the automatic conversion that the Linux tools in Initialize()
270 // All currently-defined code models guarantee that 4-byte PC-relative in Initialize()
301 if (auto *GO = dyn_cast<GlobalObject>(GV)) in getModuleMetadata() local
302 Used.insert(GO); in getModuleMetadata()
310 auto *S = C.getELFSection(".linker-options", ELF::SHT_LLVM_LINKER_OPTIONS, in emitModuleMetadata()
315 for (const auto *Operand : LinkerOptions->operands()) { in emitModuleMetadata()
316 if (cast<MDNode>(Operand)->getNumOperands() != 2) in emitModuleMetadata()
318 for (const auto &Option : cast<MDNode>(Operand)->operands()) { in emitModuleMetadata()
319 Streamer.emitBytes(cast<MDString>(Option)->getString()); in emitModuleMetadata()
325 if (NamedMDNode *DependentLibraries = M.getNamedMetadata("llvm.dependent-libraries")) { in emitModuleMetadata()
331 for (const auto *Operand : DependentLibraries->operands()) { in emitModuleMetadata()
333 cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString()); in emitModuleMetadata()
343 // we put each descriptor in a separate comdat section and rely on the in emitModuleMetadata()
345 for (const auto *Operand : FuncInfo->operands()) { in emitModuleMetadata()
347 auto *GUID = mdconst::dyn_extract<ConstantInt>(MD->getOperand(0)); in emitModuleMetadata()
348 auto *Hash = mdconst::dyn_extract<ConstantInt>(MD->getOperand(1)); in emitModuleMetadata()
349 auto *Name = cast<MDString>(MD->getOperand(2)); in emitModuleMetadata()
350 auto *S = C.getObjectFileInfo()->getPseudoProbeDescSection( in emitModuleMetadata()
351 TM->getFunctionSections() ? Name->getString() : StringRef()); in emitModuleMetadata()
354 Streamer.emitInt64(GUID->getZExtValue()); in emitModuleMetadata()
355 Streamer.emitInt64(Hash->getZExtValue()); in emitModuleMetadata()
356 Streamer.emitULEB128IntValue(Name->getString().size()); in emitModuleMetadata()
357 Streamer.emitBytes(Name->getString()); in emitModuleMetadata()
362 // Emit the metadata for llvm statistics into .llvm_stats section, which is in emitModuleMetadata()
363 // formatted as a list of key/value pair, the value is base64 encoded. in emitModuleMetadata()
364 auto *S = C.getObjectFileInfo()->getLLVMStatsSection(); in emitModuleMetadata()
366 for (const auto *Operand : LLVMStats->operands()) { in emitModuleMetadata()
368 assert(MD->getNumOperands() % 2 == 0 && in emitModuleMetadata()
370 for (size_t I = 0; I < MD->getNumOperands(); I += 2) { in emitModuleMetadata()
371 // Encode the key string size. in emitModuleMetadata()
372 auto *Key = cast<MDString>(MD->getOperand(I)); in emitModuleMetadata()
373 Streamer.emitULEB128IntValue(Key->getString().size()); in emitModuleMetadata()
374 Streamer.emitBytes(Key->getString()); in emitModuleMetadata()
375 // Encode the value into a Base64 string. in emitModuleMetadata()
377 Twine(mdconst::dyn_extract<ConstantInt>(MD->getOperand(I + 1)) in emitModuleMetadata()
378 ->getZExtValue()) in emitModuleMetadata()
409 TM.getSymbol(GV)->getName()); in getCFIPersonalitySymbol()
418 NameData += Sym->getName(); in emitPersonalityValue()
424 MCSection *Sec = getContext().getELFNamedSection(".data", Label->getName(), in emitPersonalityValue()
441 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>(); in getTTypeGlobalReference()
445 // Add information about the stub reference to ELFMMI so that the stub in getTTypeGlobalReference()
446 // gets emitted by the asmprinter. in getTTypeGlobalReference()
450 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); in getTTypeGlobalReference()
463 // N.B.: The defaults used in here are not the same ones used in MC. in getELFKindForNamedSection()
483 // Default implementation based on some magic section names. in getELFKindForNamedSection()
567 const Comdat *C = GV->getComdat(); in getELFComdat()
571 if (C->getSelectionKind() != Comdat::Any && in getELFComdat()
572 C->getSelectionKind() != Comdat::NoDeduplicate) in getELFComdat()
575 C->getName() + "' cannot be lowered."); in getELFComdat()
580 static const MCSymbolELF *getLinkedToSymbol(const GlobalObject *GO, in getLinkedToSymbol() argument
582 MDNode *MD = GO->getMetadata(LLVMContext::MD_associated); in getLinkedToSymbol()
586 auto *VM = cast<ValueAsMetadata>(MD->getOperand(0).get()); in getLinkedToSymbol()
587 auto *OtherGV = dyn_cast<GlobalValue>(VM->getValue()); in getLinkedToSymbol()
615 /// Return the section prefix name used by options FunctionsSections and
636 getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, in getELFSectionNameForGlobal() argument
640 getSectionPrefixForGlobal(Kind, TM.isLargeGlobalValue(GO)); in getELFSectionNameForGlobal()
643 // FIXME: this is getting the alignment of the character, not the in getELFSectionNameForGlobal()
644 // alignment of the global! in getELFSectionNameForGlobal()
645 Align Alignment = GO->getDataLayout().getPreferredAlign( in getELFSectionNameForGlobal()
646 cast<GlobalVariable>(GO)); in getELFSectionNameForGlobal()
658 if (const auto *F = dyn_cast<Function>(GO)) { in getELFSectionNameForGlobal()
659 if (std::optional<StringRef> Prefix = F->getSectionPrefix()) { in getELFSectionNameForGlobal()
667 TM.getNameWithPrefix(Name, GO, Mang, /*MayAlwaysUsePrivate*/true); in getELFSectionNameForGlobal()
669 // For distinguishing between .text.${text-section-prefix}. (with trailing in getELFSectionNameForGlobal()
670 // dot) and .text.${function-name} in getELFSectionNameForGlobal()
690 calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName, in calcUniqueIDUpdateFlagsAndSize() argument
696 // This works perfectly fine with section attribute or pragma section as the in calcUniqueIDUpdateFlagsAndSize()
697 // sections with the same name are grouped together by the assembler. in calcUniqueIDUpdateFlagsAndSize()
703 const bool Associated = GO->getMetadata(LLVMContext::MD_associated); in calcUniqueIDUpdateFlagsAndSize()
712 else if (Ctx.getAsmInfo()->useIntegratedAssembler() || in calcUniqueIDUpdateFlagsAndSize()
713 Ctx.getAsmInfo()->binutilsIsAtLeast(2, 36)) in calcUniqueIDUpdateFlagsAndSize()
718 // If two symbols with differing sizes end up in the same mergeable section in calcUniqueIDUpdateFlagsAndSize()
720 // usually put symbols of the same size into distinct mergeable sections with in calcUniqueIDUpdateFlagsAndSize()
721 // the same name. Doing so relies on the ",unique ," assembly feature. This in calcUniqueIDUpdateFlagsAndSize()
724 const bool SupportsUnique = Ctx.getAsmInfo()->useIntegratedAssembler() || in calcUniqueIDUpdateFlagsAndSize()
725 Ctx.getAsmInfo()->binutilsIsAtLeast(2, 35); in calcUniqueIDUpdateFlagsAndSize()
735 // If this is the first ocurrence of this section name, treat it as the in calcUniqueIDUpdateFlagsAndSize()
753 // If the user has specified the same section name as would be created in calcUniqueIDUpdateFlagsAndSize()
755 // to unique the section as the entry size for this symbol will be in calcUniqueIDUpdateFlagsAndSize()
758 getELFSectionNameForGlobal(GO, Kind, Mang, TM, EntrySize, false); in calcUniqueIDUpdateFlagsAndSize()
770 getGlobalObjectInfo(const GlobalObject *GO, const TargetMachine &TM) { in getGlobalObjectInfo() argument
774 if (const Comdat *C = getELFComdat(GO)) { in getGlobalObjectInfo()
776 Group = C->getName(); in getGlobalObjectInfo()
777 IsComdat = C->getSelectionKind() == Comdat::Any; in getGlobalObjectInfo()
779 if (TM.isLargeGlobalValue(GO)) in getGlobalObjectInfo()
785 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM, in selectExplicitSectionGlobal() argument
788 StringRef SectionName = GO->getSection(); in selectExplicitSectionGlobal()
791 // Note that pragma directive overrides -ffunction-section, -fdata-section in selectExplicitSectionGlobal()
793 const GlobalVariable *GV = dyn_cast<GlobalVariable>(GO); in selectExplicitSectionGlobal()
794 if (GV && GV->hasImplicitSection()) { in selectExplicitSectionGlobal()
795 auto Attrs = GV->getAttributes(); in selectExplicitSectionGlobal()
796 if (Attrs.hasAttribute("bss-section") && Kind.isBSS()) { in selectExplicitSectionGlobal()
797 SectionName = Attrs.getAttribute("bss-section").getValueAsString(); in selectExplicitSectionGlobal()
798 } else if (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly()) { in selectExplicitSectionGlobal()
799 SectionName = Attrs.getAttribute("rodata-section").getValueAsString(); in selectExplicitSectionGlobal()
800 } else if (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) { in selectExplicitSectionGlobal()
801 SectionName = Attrs.getAttribute("relro-section").getValueAsString(); in selectExplicitSectionGlobal()
802 } else if (Attrs.hasAttribute("data-section") && Kind.isData()) { in selectExplicitSectionGlobal()
803 SectionName = Attrs.getAttribute("data-section").getValueAsString(); in selectExplicitSectionGlobal()
807 // Infer section flags from the section name if we can. in selectExplicitSectionGlobal()
811 auto [Group, IsComdat, ExtraFlags] = getGlobalObjectInfo(GO, TM); in selectExplicitSectionGlobal()
816 GO, SectionName, Kind, TM, Ctx, Mang, Flags, EntrySize, NextUniqueID, in selectExplicitSectionGlobal()
819 const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM); in selectExplicitSectionGlobal()
825 assert(Section->getLinkedToSymbol() == LinkedToSym && in selectExplicitSectionGlobal()
828 if (!(Ctx.getAsmInfo()->useIntegratedAssembler() || in selectExplicitSectionGlobal()
829 Ctx.getAsmInfo()->binutilsIsAtLeast(2, 35))) { in selectExplicitSectionGlobal()
832 // is the case to avoid creating broken output. in selectExplicitSectionGlobal()
833 if ((Section->getFlags() & ELF::SHF_MERGE) && in selectExplicitSectionGlobal()
834 (Section->getEntrySize() != getEntrySizeForKind(Kind))) in selectExplicitSectionGlobal()
835 GO->getContext().diagnose(LoweringDiagnosticInfo( in selectExplicitSectionGlobal()
836 "Symbol '" + GO->getName() + "' from module '" + in selectExplicitSectionGlobal()
837 (GO->getParent() ? GO->getParent()->getSourceFileName() : "unknown") + in selectExplicitSectionGlobal()
838 "' required a section with entry-size=" + in selectExplicitSectionGlobal()
840 SectionName + "' with entry-size=" + Twine(Section->getEntrySize()) + in selectExplicitSectionGlobal()
849 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
850 return selectExplicitSectionGlobal(GO, Kind, TM, getContext(), getMangler(), in getExplicitSectionGlobal()
851 NextUniqueID, Used.count(GO), in getExplicitSectionGlobal()
856 MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, in selectELFSectionForGlobal() argument
860 auto [Group, IsComdat, ExtraFlags] = getGlobalObjectInfo(GO, TM); in selectELFSectionForGlobal()
863 // Get the section entry size based on the kind. in selectELFSectionForGlobal()
877 GO, Kind, Mang, TM, EntrySize, UniqueSectionName); in selectELFSectionForGlobal()
879 // Use 0 as the unique ID for execute-only text. in selectELFSectionForGlobal()
888 MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, in selectELFSectionForGlobal() argument
891 const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM); in selectELFSectionForGlobal()
900 } else if (Ctx.getAsmInfo()->useIntegratedAssembler() || in selectELFSectionForGlobal()
901 Ctx.getAsmInfo()->binutilsIsAtLeast(2, 36)) { in selectELFSectionForGlobal()
908 Ctx, GO, Kind, Mang, TM, EmitUniqueSection, Flags, in selectELFSectionForGlobal()
910 assert(Section->getLinkedToSymbol() == LinkedToSym); in selectELFSectionForGlobal()
915 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
918 // If we have -ffunction-section or -fdata-section then we should emit the in SelectSectionForGlobal()
927 EmitUniqueSection |= GO->hasComdat(); in SelectSectionForGlobal()
928 return selectELFSectionForGlobal(getContext(), GO, Kind, getMangler(), TM, in SelectSectionForGlobal()
929 Used.count(GO), EmitUniqueSection, Flags, in SelectSectionForGlobal()
937 // If the function's section names is pre-determined via pragma or a in getUniqueSectionForFunction()
951 // If the function can be removed, produce a unique section so that in getSectionForJumpTable()
952 // the table doesn't prevent the removal. in getSectionForJumpTable()
966 // If neither COMDAT nor function sections, use the monolithic LSDA section. in getSectionForLSDA()
967 // Re-use this path if LSDASection is null as in the Arm EHABI. in getSectionForLSDA()
972 unsigned Flags = LSDA->getFlags(); in getSectionForLSDA()
978 Group = C->getName(); in getSectionForLSDA()
979 IsComdat = C->getSelectionKind() == Comdat::Any; in getSectionForLSDA()
981 // Use SHF_LINK_ORDER to facilitate --gc-sections if we can use GNU ld>=2.36 in getSectionForLSDA()
982 // or LLD, which support mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER. in getSectionForLSDA()
984 (getContext().getAsmInfo()->useIntegratedAssembler() && in getSectionForLSDA()
985 getContext().getAsmInfo()->binutilsIsAtLeast(2, 36))) { in getSectionForLSDA()
990 // Append the function name as the suffix like GCC, assuming in getSectionForLSDA()
991 // -funique-section-names applies to .gcc_except_table sections. in getSectionForLSDA()
993 (TM.getUniqueSectionNames() ? LSDA->getName() + "." + F.getName() in getSectionForLSDA()
994 : LSDA->getName()), in getSectionForLSDA()
995 LSDA->getType(), Flags, 0, Group, IsComdat, MCSection::NonUniqueID, in getSectionForLSDA()
1002 // that can be marked non-executable. in shouldPutJumpTableInFunctionSection()
1006 /// Given a mergeable constant with the specified size and relocation
1026 /// Returns a unique section for the given machine basic block.
1033 // For cold sections use the .text.split. prefix along with the parent in getSectionForMachineBasicBlock()
1034 // function name. All cold blocks for the same function go to the same in getSectionForMachineBasicBlock()
1036 // under the .text.eh prefix. For regular sections, we either use a unique in getSectionForMachineBasicBlock()
1037 // name, or a unique ID for the section. in getSectionForMachineBasicBlock()
1039 StringRef FunctionSectionName = MBB.getParent()->getSection()->getName(); in getSectionForMachineBasicBlock()
1043 StringRef FunctionName = MBB.getParent()->getName(); in getSectionForMachineBasicBlock()
1055 Name += MBB.getSymbol()->getName(); in getSectionForMachineBasicBlock()
1061 // If the original function has a custom non-dot-text section, then emit in getSectionForMachineBasicBlock()
1071 GroupName = F.getComdat()->getName().str(); in getSectionForMachineBasicBlock()
1084 StringRef Comdat = KeySym ? KeySym->getName() : ""; in getStaticStructorSection()
1102 // The default scheme is .ctor / .dtor, so we have to invert the priority in getStaticStructorSection()
1109 raw_string_ostream(Name) << format(".%05u", 65535 - Priority); in getStaticStructorSection()
1131 // We may only use a PLT-relative relocation to refer to unnamed_addr in lowerRelativeReference()
1133 if (!LHS->hasGlobalUnnamedAddr() || !LHS->getValueType()->isFunctionTy()) in lowerRelativeReference()
1137 if (LHS->getType()->getPointerAddressSpace() != 0 || in lowerRelativeReference()
1138 RHS->getType()->getPointerAddressSpace() != 0 || LHS->isThreadLocal() || in lowerRelativeReference()
1139 RHS->isThreadLocal()) in lowerRelativeReference()
1152 const auto *GV = Equiv->getGlobalValue(); in lowerDSOLocalEquivalent()
1155 if (GV->isDSOLocal() || GV->isImplicitDSOLocal()) in lowerDSOLocalEquivalent()
1164 // -frecord-gcc-switches which in turn attempts to mimic GCC's switch of the in getSectionForCommandLines()
1189 //===----------------------------------------------------------------------===//
1191 //===----------------------------------------------------------------------===//
1225 // environments do not provide this function so we still need to support the in getStaticDtorSection()
1227 // See the -disable-atexit-based-global-dtor-lowering CodeGen flag for more in getStaticDtorSection()
1233 // Emit the linker options if present. in emitModuleMetadata()
1235 for (const auto *Option : LinkerOptions->operands()) { in emitModuleMetadata()
1237 for (const auto &Piece : cast<MDNode>(Option)->operands()) in emitModuleMetadata()
1238 StrOptions.push_back(std::string(cast<MDString>(Piece)->getString())); in emitModuleMetadata()
1250 // The section is mandatory. If we don't have it, then we don't have GC info. in emitModuleMetadata()
1259 // If invalid, report the error with report_fatal_error. in emitModuleMetadata()
1264 // Get the section. in emitModuleMetadata()
1276 const Comdat *C = GV->getComdat(); in checkMachOComdat()
1280 report_fatal_error("MachO doesn't support COMDATs, '" + C->getName() + in checkMachOComdat()
1285 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
1287 StringRef SectionName = GO->getSection(); in getExplicitSectionGlobal()
1289 const GlobalVariable *GV = dyn_cast<GlobalVariable>(GO); in getExplicitSectionGlobal()
1290 if (GV && GV->hasImplicitSection()) { in getExplicitSectionGlobal()
1291 auto Attrs = GV->getAttributes(); in getExplicitSectionGlobal()
1292 if (Attrs.hasAttribute("bss-section") && Kind.isBSS()) { in getExplicitSectionGlobal()
1293 SectionName = Attrs.getAttribute("bss-section").getValueAsString(); in getExplicitSectionGlobal()
1294 } else if (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly()) { in getExplicitSectionGlobal()
1295 SectionName = Attrs.getAttribute("rodata-section").getValueAsString(); in getExplicitSectionGlobal()
1296 } else if (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) { in getExplicitSectionGlobal()
1297 SectionName = Attrs.getAttribute("relro-section").getValueAsString(); in getExplicitSectionGlobal()
1298 } else if (Attrs.hasAttribute("data-section") && Kind.isData()) { in getExplicitSectionGlobal()
1299 SectionName = Attrs.getAttribute("data-section").getValueAsString(); in getExplicitSectionGlobal()
1303 // Parse the section specifier and create it if valid. in getExplicitSectionGlobal()
1308 checkMachOComdat(GO); in getExplicitSectionGlobal()
1312 // If invalid, report the error with report_fatal_error. in getExplicitSectionGlobal()
1313 report_fatal_error("Global variable '" + GO->getName() + in getExplicitSectionGlobal()
1315 GO->getSection() + "': " + toString(std::move(E)) + "."); in getExplicitSectionGlobal()
1318 // Get the section. in getExplicitSectionGlobal()
1323 // use the value returned by getMachOSection() as a default. in getExplicitSectionGlobal()
1325 TAA = S->getTypeAndAttributes(); in getExplicitSectionGlobal()
1327 // Okay, now that we got the section, verify that the TAA & StubSize agree. in getExplicitSectionGlobal()
1328 // If the user declared multiple globals with different section flags, we need in getExplicitSectionGlobal()
1330 if (S->getTypeAndAttributes() != TAA || S->getStubSize() != StubSize) { in getExplicitSectionGlobal()
1331 // If invalid, report the error with report_fatal_error. in getExplicitSectionGlobal()
1332 report_fatal_error("Global variable '" + GO->getName() + in getExplicitSectionGlobal()
1341 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
1342 checkMachOComdat(GO); in SelectSectionForGlobal()
1349 return GO->isWeakForLinker() ? TextCoalSection : TextSection; in SelectSectionForGlobal()
1352 // or data depending on if it is writable. in SelectSectionForGlobal()
1353 if (GO->isWeakForLinker()) { in SelectSectionForGlobal()
1363 GO->getDataLayout().getPreferredAlign( in SelectSectionForGlobal()
1364 cast<GlobalVariable>(GO)) < Align(32)) in SelectSectionForGlobal()
1367 // Do not put 16-bit arrays in the UString section if they have an in SelectSectionForGlobal()
1370 if (Kind.isMergeable2ByteCString() && !GO->hasExternalLinkage() && in SelectSectionForGlobal()
1371 GO->getDataLayout().getPreferredAlign( in SelectSectionForGlobal()
1372 cast<GlobalVariable>(GO)) < Align(32)) in SelectSectionForGlobal()
1377 if (GO->hasPrivateLinkage() && Kind.isMergeableConst()) { in SelectSectionForGlobal()
1391 // If this is marked const, put it into a const section. But if the dynamic in SelectSectionForGlobal()
1392 // linker needs to write to it, put it in the data segment. in SelectSectionForGlobal()
1396 // Put zero initialized globals with strong external linkage in the in SelectSectionForGlobal()
1397 // DATA, __common section with the .zerofill directive. in SelectSectionForGlobal()
1402 // with the .zerofill directive (aka .lcomm). in SelectSectionForGlobal()
1406 // Otherwise, just drop the variable in the normal data section. in SelectSectionForGlobal()
1413 // If this constant requires a relocation, we have to put it in the data in getSectionForConstant()
1414 // segment, not in the text segment. in getSectionForConstant()
1435 // The mach-o version of this method defaults to returning a stub reference. in getTTypeGlobalReference()
1439 MMI->getObjFileInfo<MachineModuleInfoMachO>(); in getTTypeGlobalReference()
1443 // Add information about the stub reference to MachOMMI so that the stub in getTTypeGlobalReference()
1444 // gets emitted by the asmprinter. in getTTypeGlobalReference()
1448 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); in getTTypeGlobalReference()
1463 // The mach-o version of this method defaults to returning a stub reference. in getCFIPersonalitySymbol()
1465 MMI->getObjFileInfo<MachineModuleInfoMachO>(); in getCFIPersonalitySymbol()
1469 // Add information about the stub reference to MachOMMI so that the stub in getCFIPersonalitySymbol()
1470 // gets emitted by the asmprinter. in getCFIPersonalitySymbol()
1474 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); in getCFIPersonalitySymbol()
1483 // Although MachO 32-bit targets do not explicitly have a GOTPCREL relocation in getIndirectSymViaGOTPCRel()
1484 // as 64-bit do, we replace the GOT equivalent by accessing the final symbol in getIndirectSymViaGOTPCRel()
1485 // through a non_lazy_ptr stub instead. One advantage is that it allows the in getIndirectSymViaGOTPCRel()
1492 // .long _extgotequiv-_delta in getIndirectSymViaGOTPCRel()
1497 // .long L_extfoo$non_lazy_ptr-(_delta+0) in getIndirectSymViaGOTPCRel()
1504 // The indirect symbol table (and sections of non_lazy_symbol_pointers type) in getIndirectSymViaGOTPCRel()
1516 // If the symbol is local, instead of the symbol's index, the assembler in getIndirectSymViaGOTPCRel()
1517 // places the constant INDIRECT_SYMBOL_LOCAL into the indirect symbol table. in getIndirectSymViaGOTPCRel()
1518 // Then the linker will notice the constant in the table and will look at the in getIndirectSymViaGOTPCRel()
1519 // content of the symbol. in getIndirectSymViaGOTPCRel()
1521 MMI->getObjFileInfo<MachineModuleInfoMachO>(); in getIndirectSymViaGOTPCRel()
1524 // The offset must consider the original displacement from the base symbol in getIndirectSymViaGOTPCRel()
1525 // since 32-bit targets don't have a GOTPCREL to fold the PC displacement. in getIndirectSymViaGOTPCRel()
1526 Offset = -MV.getConstant(); in getIndirectSymViaGOTPCRel()
1527 const MCSymbol *BaseSym = &MV.getSymB()->getSymbol(); in getIndirectSymViaGOTPCRel()
1529 // Access the final symbol via sym$non_lazy_ptr and generate the appropriated in getIndirectSymViaGOTPCRel()
1533 Name += MMI->getModule()->getDataLayout().getPrivateGlobalPrefix(); in getIndirectSymViaGOTPCRel()
1534 Name += Sym->getName(); in getIndirectSymViaGOTPCRel()
1542 !GV->hasLocalLinkage()); in getIndirectSymViaGOTPCRel()
1563 // dead-stripped (there's no issue with blocking atomization there), but `ld in canUsePrivateLabel()
1564 // -r` sometimes drops the no_dead_strip attribute from sections so for safety in canUsePrivateLabel()
1573 if (auto *GO = GV->getAliaseeObject()) { in getNameWithPrefix() local
1574 SectionKind GOKind = TargetLoweringObjectFile::getKindForGlobal(GO, TM); in getNameWithPrefix()
1575 const MCSection *TheSection = SectionForGlobal(GO, GOKind, TM); in getNameWithPrefix()
1582 //===----------------------------------------------------------------------===//
1584 //===----------------------------------------------------------------------===//
1627 const Comdat *C = GV->getComdat(); in getComdatGVForCOFF()
1630 StringRef ComdatGVName = C->getName(); in getComdatGVForCOFF()
1631 const GlobalValue *ComdatGV = GV->getParent()->getNamedValue(ComdatGVName); in getComdatGVForCOFF()
1636 if (ComdatGV->getComdat() != C) in getComdatGVForCOFF()
1644 if (const Comdat *C = GV->getComdat()) { in getSelectionForCOFF()
1647 ComdatKey = GA->getAliaseeObject(); in getSelectionForCOFF()
1649 switch (C->getSelectionKind()) { in getSelectionForCOFF()
1669 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
1670 StringRef Name = GO->getSection(); in getExplicitSectionGlobal()
1683 if (GO->hasComdat()) { in getExplicitSectionGlobal()
1684 Selection = getSelectionForCOFF(GO); in getExplicitSectionGlobal()
1687 ComdatGV = getComdatGVForCOFF(GO); in getExplicitSectionGlobal()
1689 ComdatGV = GO; in getExplicitSectionGlobal()
1691 if (!ComdatGV->hasPrivateLinkage()) { in getExplicitSectionGlobal()
1693 COMDATSymName = Sym->getName(); in getExplicitSectionGlobal()
1717 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
1718 // If we have -ffunction-sections then we should emit the global value to a in SelectSectionForGlobal()
1726 if ((EmitUniquedSection && !Kind.isCommon()) || GO->hasComdat()) { in SelectSectionForGlobal()
1732 int Selection = getSelectionForCOFF(GO); in SelectSectionForGlobal()
1736 if (GO->hasComdat()) in SelectSectionForGlobal()
1737 ComdatGV = getComdatGVForCOFF(GO); in SelectSectionForGlobal()
1739 ComdatGV = GO; in SelectSectionForGlobal()
1745 if (!ComdatGV->hasPrivateLinkage()) { in SelectSectionForGlobal()
1747 StringRef COMDATSymName = Sym->getName(); in SelectSectionForGlobal()
1749 if (const auto *F = dyn_cast<Function>(GO)) in SelectSectionForGlobal()
1750 if (std::optional<StringRef> Prefix = F->getSectionPrefix()) in SelectSectionForGlobal()
1753 // Append "$symbol" to the section name *before* IR-level mangling is in SelectSectionForGlobal()
1754 // applied when targetting mingw. This is what GCC does, and the ld.bfd in SelectSectionForGlobal()
1757 raw_svector_ostream(Name) << '$' << ComdatGV->getName(); in SelectSectionForGlobal()
1763 getMangler().getNameWithPrefix(TmpData, GO, /*CannotUsePrivateLabel=*/true); in SelectSectionForGlobal()
1779 // really emitted with the magic .comm directive, which creates a symbol table in SelectSectionForGlobal()
1791 if (GV->hasPrivateLinkage() && in getNameWithPrefix()
1801 // If the function can be removed, produce a unique section so that in getSectionForJumpTable()
1802 // the table doesn't prevent the removal. in getSectionForJumpTable()
1813 StringRef COMDATSymName = Sym->getName(); in getSectionForJumpTable()
1828 if (TM->getTargetTriple().getArch() == Triple::x86_64) { in shouldPutJumpTableInFunctionSection()
1831 // that can be marked non-executable. in shouldPutJumpTableInFunctionSection()
1865 // Emit the linker options to the linker .drectve section. According to the in emitLinkerDirectives()
1866 // spec, this section is a space-separated string containing flags for in emitLinkerDirectives()
1870 for (const auto *Option : LinkerOptions->operands()) { in emitLinkerDirectives()
1871 for (const auto &Piece : cast<MDNode>(Option)->operands()) { in emitLinkerDirectives()
1874 Directive.append(std::string(cast<MDString>(Piece)->getString())); in emitLinkerDirectives()
1896 assert(LU->hasInitializer() && "expected llvm.used to have an initializer"); in emitLinkerDirectives()
1897 assert(isa<ArrayType>(LU->getValueType()) && in emitLinkerDirectives()
1899 if (const auto *A = cast<ConstantArray>(LU->getInitializer())) { in emitLinkerDirectives()
1900 for (const Value *Op : A->operands()) { in emitLinkerDirectives()
1901 const auto *GV = cast<GlobalValue>(Op->stripPointerCasts()); in emitLinkerDirectives()
1903 // the linker, and thus would cause an error when the linker tried to in emitLinkerDirectives()
1904 // preserve the symbol due to the `/include:` directive. in emitLinkerDirectives()
1905 if (GV->hasLocalLinkage()) in emitLinkerDirectives()
1926 this->TM = &TM; in Initialize()
1951 // If the priority is the default, use .CRT$XCU, possibly associative. in getCOFFStaticStructorSection()
1956 // run earlier. The linker will sort sections ASCII-betically, and we need a in getCOFFStaticStructorSection()
1957 // string that sorts between .CRT$XCA and .CRT$XCU. In the general case, we in getCOFFStaticStructorSection()
1959 // low priorities need to sort before 'L', since the CRT uses that in getCOFFStaticStructorSection()
1961 // the frontend that "init_seg(compiler)" corresponds to priority 200 and in getCOFFStaticStructorSection()
1963 // 'C' and 'L' without the priority suffix. Priorities between 200 and 400 in getCOFFStaticStructorSection()
1964 // use 'C' with the priority as a suffix. in getCOFFStaticStructorSection()
1985 raw_string_ostream(Name) << format(".%05u", 65535 - Priority); in getCOFFStaticStructorSection()
2015 // Our symbols should exist in address space zero, cowardly no-op if in lowerRelativeReference()
2017 if (LHS->getType()->getPointerAddressSpace() != 0 || in lowerRelativeReference()
2018 RHS->getType()->getPointerAddressSpace() != 0) in lowerRelativeReference()
2022 // - Only global variables are eligible for image relative relocations. in lowerRelativeReference()
2023 // - The subtrahend refers to the special symbol __ImageBase, a GlobalVariable. in lowerRelativeReference()
2029 LHS->isThreadLocal() || RHS->isThreadLocal() || in lowerRelativeReference()
2030 RHS->getName() != "__ImageBase" || !RHS->hasExternalLinkage() || in lowerRelativeReference()
2031 cast<GlobalVariable>(RHS)->hasInitializer() || RHS->hasSection()) in lowerRelativeReference()
2045 HexString.insert(HexString.begin(), Width - Size, '0'); in APIntToHexString()
2051 Type *Ty = C->getType(); in scalarConstantToHexString()
2053 return APIntToHexString(APInt::getZero(Ty->getPrimitiveSizeInBits())); in scalarConstantToHexString()
2055 return APIntToHexString(CFP->getValueAPF().bitcastToAPInt()); in scalarConstantToHexString()
2057 return APIntToHexString(CI->getValue()); in scalarConstantToHexString()
2061 NumElements = cast<FixedVectorType>(VTy)->getNumElements(); in scalarConstantToHexString()
2063 NumElements = Ty->getArrayNumElements(); in scalarConstantToHexString()
2065 for (int I = NumElements - 1, E = -1; I != E; --I) in scalarConstantToHexString()
2066 HexString += scalarConstantToHexString(C->getAggregateElement(I)); in scalarConstantToHexString()
2075 getContext().getAsmInfo()->hasCOFFComdatConstants()) { in getSectionForConstant()
2076 // This creates comdat sections with the given symbol name, but unless in getSectionForConstant()
2077 // AsmPrinter::GetCPISymbol actually makes the symbol global, the symbol in getSectionForConstant()
2095 // FIXME: These may not be appropriate for non-x86 architectures. in getSectionForConstant()
2117 //===----------------------------------------------------------------------===//
2119 //===----------------------------------------------------------------------===//
2122 const Comdat *C = GV->getComdat(); in getWasmComdat()
2126 if (C->getSelectionKind() != Comdat::Any) in getWasmComdat()
2128 "SelectionKind::Any, '" + C->getName() + "' cannot be " in getWasmComdat()
2155 if (auto *GO = dyn_cast<GlobalObject>(GV)) in getModuleMetadata() local
2156 Used.insert(GO); in getModuleMetadata()
2160 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
2161 // We don't support explict section names for functions in the wasm object in getExplicitSectionGlobal()
2163 if (isa<Function>(GO)) { in getExplicitSectionGlobal()
2164 return SelectSectionForGlobal(GO, Kind, TM); in getExplicitSectionGlobal()
2167 StringRef Name = GO->getSection(); in getExplicitSectionGlobal()
2170 // segments within the data section. in getExplicitSectionGlobal()
2171 // This could be avoided if all data segements (the wasm sense) were in getExplicitSectionGlobal()
2172 // represented as their own sections (in the llvm sense). in getExplicitSectionGlobal()
2173 // TODO(sbc): https://github.com/WebAssembly/tool-conventions/issues/138 in getExplicitSectionGlobal()
2178 if (const Comdat *C = getWasmComdat(GO)) { in getExplicitSectionGlobal()
2179 Group = C->getName(); in getExplicitSectionGlobal()
2182 unsigned Flags = getWasmSectionFlags(Kind, Used.count(GO)); in getExplicitSectionGlobal()
2190 selectWasmSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, in selectWasmSectionForGlobal() argument
2195 if (const Comdat *C = getWasmComdat(GO)) { in selectWasmSectionForGlobal()
2196 Group = C->getName(); in selectWasmSectionForGlobal()
2202 if (const auto *F = dyn_cast<Function>(GO)) { in selectWasmSectionForGlobal()
2203 const auto &OptionalPrefix = F->getSectionPrefix(); in selectWasmSectionForGlobal()
2210 TM.getNameWithPrefix(Name, GO, Mang, true); in selectWasmSectionForGlobal()
2223 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
2226 report_fatal_error("mergable sections not supported yet on wasm"); in SelectSectionForGlobal()
2228 // If we have -ffunction-section or -fdata-section then we should emit the in SelectSectionForGlobal()
2235 EmitUniqueSection |= GO->hasComdat(); in SelectSectionForGlobal()
2236 bool Retain = Used.count(GO); in SelectSectionForGlobal()
2239 return selectWasmSectionForGlobal(getContext(), GO, Kind, getMangler(), TM, in SelectSectionForGlobal()
2246 // that can be marked non-executable. in shouldPutJumpTableInFunctionSection()
2253 // We may only use a PLT-relative relocation to refer to unnamed_addr in lowerRelativeReference()
2255 if (!LHS->hasGlobalUnnamedAddr() || !LHS->getValueType()->isFunctionTy()) in lowerRelativeReference()
2259 if (LHS->getType()->getPointerAddressSpace() != 0 || in lowerRelativeReference()
2260 RHS->getType()->getPointerAddressSpace() != 0 || LHS->isThreadLocal() || in lowerRelativeReference()
2261 RHS->isThreadLocal()) in lowerRelativeReference()
2292 //===----------------------------------------------------------------------===//
2294 //===----------------------------------------------------------------------===//
2297 if (!MF->getLandingPads().empty()) in ShouldEmitEHBlock()
2300 const Function &F = MF->getFunction(); in ShouldEmitEHBlock()
2305 dyn_cast<GlobalValue>(F.getPersonalityFn()->stripPointerCasts()); in ShouldEmitEHBlock()
2315 const Function &F = MF->getFunction(); in ShouldSetSSPCanaryBitInTB()
2319 // There are cases that the stack protectors are not really inserted even if in ShouldSetSSPCanaryBitInTB()
2320 // the attributes are on. in ShouldSetSSPCanaryBitInTB()
2326 MCSymbol *EHInfoSym = MF->getContext().getOrCreateSymbol( in getEHInfoTableSymbol()
2327 "__ehinfo." + Twine(MF->getFunctionNumber())); in getEHInfoTableSymbol()
2328 cast<MCSymbolXCOFF>(EHInfoSym)->setEHInfo(); in getEHInfoTableSymbol()
2337 // If a GV represents a GlobalVariable and -fdata-sections is enabled, we in getTargetSymbol()
2339 // It is inherently ambiguous when the GO represents the address of a in getTargetSymbol()
2340 // function, as the GO could either represent a function descriptor or a in getTargetSymbol()
2343 if (const GlobalObject *GO = dyn_cast<GlobalObject>(GV)) { in getTargetSymbol() local
2344 if (GO->isDeclarationForLinker()) in getTargetSymbol()
2345 return cast<MCSectionXCOFF>(getSectionForExternalReference(GO, TM)) in getTargetSymbol()
2346 ->getQualNameSymbol(); in getTargetSymbol()
2349 if (GVar->hasAttribute("toc-data")) in getTargetSymbol()
2352 ->getQualNameSymbol(); in getTargetSymbol()
2354 SectionKind GOKind = getKindForGlobal(GO, TM); in getTargetSymbol()
2357 getSectionForFunctionDescriptor(cast<Function>(GO), TM)) in getTargetSymbol()
2358 ->getQualNameSymbol(); in getTargetSymbol()
2359 if ((TM.getDataSections() && !GO->hasSection()) || GO->hasCommonLinkage() || in getTargetSymbol()
2361 return cast<MCSectionXCOFF>(SectionForGlobal(GO, GOKind, TM)) in getTargetSymbol()
2362 ->getQualNameSymbol(); in getTargetSymbol()
2365 // For all other cases, fall back to getSymbol to return the unqualified name. in getTargetSymbol()
2370 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
2371 if (!GO->hasSection()) in getExplicitSectionGlobal()
2374 StringRef SectionName = GO->getSection(); in getExplicitSectionGlobal()
2376 // Handle the XCOFF::TD case first, then deal with the rest. in getExplicitSectionGlobal()
2377 if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO)) in getExplicitSectionGlobal()
2378 if (GVar->hasAttribute("toc-data")) in getExplicitSectionGlobal()
2403 const GlobalObject *GO, const TargetMachine &TM) const { in getSectionForExternalReference() argument
2404 assert(GO->isDeclarationForLinker() && in getSectionForExternalReference()
2408 getNameWithPrefix(Name, GO, TM); in getSectionForExternalReference()
2410 // AIX TLS local-dynamic does not need the external reference for the in getSectionForExternalReference()
2412 if (GO->getThreadLocalMode() == GlobalVariable::LocalDynamicTLSModel && in getSectionForExternalReference()
2413 GO->hasName() && GO->getName() == "_$TLSML") { in getSectionForExternalReference()
2420 isa<Function>(GO) ? XCOFF::XMC_DS : XCOFF::XMC_UA; in getSectionForExternalReference()
2421 if (GO->isThreadLocal()) in getSectionForExternalReference()
2424 if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO)) in getSectionForExternalReference()
2425 if (GVar->hasAttribute("toc-data")) in getSectionForExternalReference()
2428 // Externals go into a csect of type ER. in getSectionForExternalReference()
2435 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
2436 // Handle the XCOFF::TD case first, then deal with the rest. in SelectSectionForGlobal()
2437 if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO)) in SelectSectionForGlobal()
2438 if (GVar->hasAttribute("toc-data")) { in SelectSectionForGlobal()
2440 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2442 GO->hasCommonLinkage() ? XCOFF::XTY_CM : XCOFF::XTY_SD; in SelectSectionForGlobal()
2448 // Common symbols go into a csect with matching name which will get mapped in SelectSectionForGlobal()
2449 // into the .bss section. in SelectSectionForGlobal()
2450 // Zero-initialized local TLS symbols go into a csect with matching name which in SelectSectionForGlobal()
2451 // will get mapped into the .tbss section. in SelectSectionForGlobal()
2452 if (Kind.isBSSLocal() || GO->hasCommonLinkage() || Kind.isThreadBSSLocal()) { in SelectSectionForGlobal()
2454 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2464 return cast<MCSymbolXCOFF>(getFunctionEntryPointSymbol(GO, TM)) in SelectSectionForGlobal()
2465 ->getRepresentedCsect(); in SelectSectionForGlobal()
2473 "ReadOnlyPointers is supported only if data sections is turned on"); in SelectSectionForGlobal()
2476 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2482 // For BSS kind, zero initialized data must be emitted to the .data section in SelectSectionForGlobal()
2483 // because external linkage control sections that get mapped to the .bss in SelectSectionForGlobal()
2489 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2500 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2511 // are emitted into the .tdata section. in SelectSectionForGlobal()
2515 getNameWithPrefix(Name, GO, TM); in SelectSectionForGlobal()
2527 assert (!F.getComdat() && "Comdat not supported on XCOFF."); in getSectionForJumpTable()
2532 // If the function can be removed, produce a unique section so that in getSectionForJumpTable()
2533 // the table doesn't prevent the removal. in getSectionForJumpTable()
2546 /// Given a mergeable constant with the specified size and relocation
2580 // mode, the relocatable address for the thread local variable will cause in Initialize()
2581 // linker error. So disable the location attribute generation for thread local in Initialize()
2583 // FIXME: when TLS debug on AIX is ready, remove this setting. in Initialize()
2589 report_fatal_error("no static constructor section on AIX"); in getStaticCtorSection()
2594 report_fatal_error("no static destructor section on AIX"); in getStaticDtorSection()
2606 assert(!isa<GlobalIFunc>(GV) && "GlobalIFunc is not supported on AIX."); in getStorageClassForGlobal()
2608 switch (GV->getLinkage()) { in getStorageClassForGlobal()
2634 cast<GlobalAlias>(Func)->getAliaseeObject()))) && in getFunctionEntryPointSymbol()
2642 // When -function-sections is enabled and explicit section is not specified, in getFunctionEntryPointSymbol()
2644 // function entry point csect instead. And for function delcarations, the in getFunctionEntryPointSymbol()
2646 if (((TM.getFunctionSections() && !Func->hasSection()) || in getFunctionEntryPointSymbol()
2647 Func->isDeclarationForLinker()) && in getFunctionEntryPointSymbol()
2652 XCOFF::CsectProperties(XCOFF::XMC_PR, Func->isDeclarationForLinker() in getFunctionEntryPointSymbol()
2655 ->getQualNameSymbol(); in getFunctionEntryPointSymbol()
2676 // The "_$TLSML" symbol for TLS local-dynamic mode requires XMC_TC, in getSectionForTOCEntry()
2677 // otherwise the AIX assembler will complain. in getSectionForTOCEntry()
2678 if (XSym->getSymbolTableName() == "_$TLSML") in getSectionForTOCEntry()
2682 // never referenced directly. The runtime loads their TOC entry in getSectionForTOCEntry()
2683 // addresses from the trace-back table. in getSectionForTOCEntry()
2684 if (XSym->isEHInfo()) in getSectionForTOCEntry()
2687 // If the symbol does not have a code model specified use the module value. in getSectionForTOCEntry()
2688 if (!XSym->hasPerSymbolCodeModel()) in getSectionForTOCEntry()
2692 return XSym->getPerSymbolCodeModel() == MCSymbolXCOFF::CM_Large in getSectionForTOCEntry()
2698 cast<MCSymbolXCOFF>(Sym)->getSymbolTableName(), SectionKind::getData(), in getSectionForTOCEntry()
2706 // If option -ffunction-sections is on, append the function name to the in getSectionForLSDA()
2707 // name of the LSDA csect so that each function has its own LSDA csect. in getSectionForLSDA()
2708 // This helps the linker to garbage-collect EH info of unused functions. in getSectionForLSDA()
2709 SmallString<128> NameStr = LSDA->getName(); in getSectionForLSDA()
2711 LSDA = getContext().getXCOFFSection(NameStr, LSDA->getKind(), in getSectionForLSDA()
2712 LSDA->getCsectProp()); in getSectionForLSDA()
2716 //===----------------------------------------------------------------------===//
2718 //===----------------------------------------------------------------------===//
2722 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in getExplicitSectionGlobal() argument
2723 return SelectSectionForGlobal(GO, Kind, TM); in getExplicitSectionGlobal()
2733 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { in SelectSectionForGlobal() argument
2734 auto *Symbol = TM.getSymbol(GO); in SelectSectionForGlobal()
2736 return getContext().getGOFFSection(Symbol->getName(), SectionKind::getBSS(), in SelectSectionForGlobal()
2739 return getContext().getObjectFileInfo()->getTextSection(); in SelectSectionForGlobal()