Răsfoiți Sursa

Add a method to get the object-file appropriate stack map section.

Thanks to Eric Christopher for the tips on the appropriate way to do this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194282 91177308-0d34-0410-b5e6-96231b3b80d8
Lang Hames 11 ani în urmă
părinte
comite
c87e438054

+ 4 - 0
include/llvm/MC/MCObjectFileInfo.h

@@ -142,6 +142,8 @@ protected:
   /// ELF and MachO only.
   /// ELF and MachO only.
   const MCSection *TLSBSSSection;         // Defaults to ".tbss".
   const MCSection *TLSBSSSection;         // Defaults to ".tbss".
 
 
+  /// StackMap section.
+  const MCSection *StackMapSection;
 
 
   /// EHFrameSection - EH frame section. It is initialized on demand so it
   /// EHFrameSection - EH frame section. It is initialized on demand so it
   /// can be overwritten (with uniquing).
   /// can be overwritten (with uniquing).
@@ -285,6 +287,8 @@ public:
   const MCSection *getTLSDataSection() const { return TLSDataSection; }
   const MCSection *getTLSDataSection() const { return TLSDataSection; }
   const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
   const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
 
 
+  const MCSection *getStackMapSection() const { return StackMapSection; }
+
   /// ELF specific sections.
   /// ELF specific sections.
   ///
   ///
   const MCSection *getDataRelSection() const { return DataRelSection; }
   const MCSection *getDataRelSection() const { return DataRelSection; }

+ 1 - 2
lib/CodeGen/StackMaps.cpp

@@ -97,8 +97,7 @@ void StackMaps::serializeToStackMapSection() {
 
 
   // Create the section.
   // Create the section.
   const MCSection *StackMapSection =
   const MCSection *StackMapSection =
-    OutContext.getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
-                               SectionKind::getMetadata());
+    OutContext.getObjectFileInfo().getStackMapSection();
   AP.OutStreamer.SwitchSection(StackMapSection);
   AP.OutStreamer.SwitchSection(StackMapSection);
 
 
   // Emit a dummy symbol to force section inclusion.
   // Emit a dummy symbol to force section inclusion.

+ 3 - 0
lib/MC/MCObjectFileInfo.cpp

@@ -234,6 +234,9 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
     Ctx->getMachOSection("__DWARF", "__debug_inlined",
     Ctx->getMachOSection("__DWARF", "__debug_inlined",
                          MCSectionMachO::S_ATTR_DEBUG,
                          MCSectionMachO::S_ATTR_DEBUG,
                          SectionKind::getMetadata());
                          SectionKind::getMetadata());
+  StackMapSection =
+    Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
+                         SectionKind::getMetadata());
 
 
   TLSExtraDataSection = TLSTLVSection;
   TLSExtraDataSection = TLSTLVSection;
 }
 }