[llvm-branch-commits] [llvm] [GOFF] Add writing of section symbols (PR #133799)

Kai Nacke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 3 10:10:34 PDT 2025


================
@@ -2767,15 +2774,55 @@ MCSection *TargetLoweringObjectFileGOFF::getExplicitSectionGlobal(
 MCSection *TargetLoweringObjectFileGOFF::getSectionForLSDA(
     const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const {
   std::string Name = ".gcc_exception_table." + F.getName().str();
-  return getContext().getGOFFSection(Name, SectionKind::getData(), nullptr, 0);
+  constexpr bool Is64Bit = true;
+  constexpr bool UsesXPLINK = true;
+  return getContext().getGOFFSection(
+      SectionKind::getData(), GOFF::WSA<true>,
+      GOFF::EDAttr{false, GOFF::ESD_EXE_DATA, GOFF::AMODE<Is64Bit>,
+                   GOFF::RMODE<Is64Bit>, GOFF::ESD_NS_Parts,
+                   GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Merge,
+                   GOFF::LOADBEHAVIOR<UsesXPLINK>, GOFF::ESD_RQ_0,
+                   GOFF::ESD_ALIGN_Doubleword},
+      Name,
+      GOFF::PRAttr{true, false, GOFF::ESD_EXE_Unspecified, GOFF::ESD_NS_Parts,
+                   GOFF::LINKAGE<UsesXPLINK>, GOFF::AMODE<Is64Bit>,
+                   GOFF::ESD_BSC_Section, GOFF::ESD_DSS_NoWarning,
+                   GOFF::ESD_ALIGN_Fullword, 0});
 }
 
 MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
     const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
   auto *Symbol = TM.getSymbol(GO);
-  if (Kind.isBSS())
-    return getContext().getGOFFSection(Symbol->getName(), SectionKind::getBSS(),
-                                       nullptr, 0);
-
-  return getContext().getObjectFileInfo()->getTextSection();
+  constexpr bool Is64Bit = true;
+  constexpr bool UsesXPLINK = true;
+
+  if (Kind.isBSS() || Kind.isData()) {
----------------
redstar wrote:

Yes.

https://github.com/llvm/llvm-project/pull/133799


More information about the llvm-branch-commits mailing list