Add a method to get the object-file appropriate stack map section.
authorLang Hames <lhames@gmail.com>
Fri, 8 Nov 2013 22:14:49 +0000 (22:14 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 8 Nov 2013 22:14:49 +0000 (22:14 +0000)
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

include/llvm/MC/MCObjectFileInfo.h
lib/CodeGen/StackMaps.cpp
lib/MC/MCObjectFileInfo.cpp

index 5e5debe0548fe66e9c450e36a5d64bad7e562ed5..c48dcb021620d022fe467982f9d225689c07720c 100644 (file)
@@ -142,6 +142,8 @@ protected:
   /// ELF and MachO only.
   const MCSection *TLSBSSSection;         // Defaults to ".tbss".
 
+  /// StackMap section.
+  const MCSection *StackMapSection;
 
   /// EHFrameSection - EH frame section. It is initialized on demand so it
   /// can be overwritten (with uniquing).
@@ -285,6 +287,8 @@ public:
   const MCSection *getTLSDataSection() const { return TLSDataSection; }
   const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
 
+  const MCSection *getStackMapSection() const { return StackMapSection; }
+
   /// ELF specific sections.
   ///
   const MCSection *getDataRelSection() const { return DataRelSection; }
index b9b652d98d6798b1d575b48a46d3df4407630ce7..b6a900ab495f6353fd039df94d246135214db3a8 100644 (file)
@@ -97,8 +97,7 @@ void StackMaps::serializeToStackMapSection() {
 
   // Create the section.
   const MCSection *StackMapSection =
-    OutContext.getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
-                               SectionKind::getMetadata());
+    OutContext.getObjectFileInfo().getStackMapSection();
   AP.OutStreamer.SwitchSection(StackMapSection);
 
   // Emit a dummy symbol to force section inclusion.
index 958648c656ef47a7e9eca2f3c0bb21ee3f50bcb3..8ef4a0a6d7b14351033fcabe281c9e1395638b60 100644 (file)
@@ -234,6 +234,9 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
     Ctx->getMachOSection("__DWARF", "__debug_inlined",
                          MCSectionMachO::S_ATTR_DEBUG,
                          SectionKind::getMetadata());
+  StackMapSection =
+    Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
+                         SectionKind::getMetadata());
 
   TLSExtraDataSection = TLSTLVSection;
 }