Expose a way to get the beginning of the dwarf string section.
authorEric Christopher <echristo@apple.com>
Mon, 7 Nov 2011 09:18:38 +0000 (09:18 +0000)
committerEric Christopher <echristo@apple.com>
Mon, 7 Nov 2011 09:18:38 +0000 (09:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143920 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index d1e4ca4b5fafec074e6a1556ba0cf5cb3ccab90d..037b4ace02636f3933b445ce908fbec81b188a73 100644 (file)
@@ -136,6 +136,18 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
 DwarfDebug::~DwarfDebug() {
 }
 
+/// EmitSectionSym - Switch to the specified MCSection and emit an assembler
+/// temporary label to it if SymbolStem is specified.
+static MCSymbol *EmitSectionSym(AsmPrinter *Asm, const MCSection *Section,
+                                const char *SymbolStem = 0) {
+  Asm->OutStreamer.SwitchSection(Section);
+  if (!SymbolStem) return 0;
+
+  MCSymbol *TmpSym = Asm->GetTempSymbol(SymbolStem);
+  Asm->OutStreamer.EmitLabel(TmpSym);
+  return TmpSym;
+}
+
 MCSymbol *DwarfDebug::getStringPool() {
   return Asm->GetTempSymbol("section_str");
 }
@@ -148,6 +160,13 @@ MCSymbol *DwarfDebug::getStringPoolEntry(StringRef Str) {
   return Entry.first = Asm->GetTempSymbol("string", Entry.second);
 }
 
+MCSymbol *DwarfDebug::getDwarfStrSectionSym(void) {
+  if (DwarfStrSectionSym) return DwarfStrSectionSym;
+  DwarfStrSectionSym =
+    EmitSectionSym(Asm, Asm->getObjFileLowering().getDwarfStrSection(),
+                   "section_str");
+  return DwarfStrSectionSym;
+}
 
 /// assignAbbrevNumber - Define a unique number for the abbreviation.
 ///
@@ -1465,18 +1484,6 @@ void DwarfDebug::computeSizeAndOffsets() {
   }
 }
 
-/// EmitSectionSym - Switch to the specified MCSection and emit an assembler
-/// temporary label to it if SymbolStem is specified.
-static MCSymbol *EmitSectionSym(AsmPrinter *Asm, const MCSection *Section,
-                                const char *SymbolStem = 0) {
-  Asm->OutStreamer.SwitchSection(Section);
-  if (!SymbolStem) return 0;
-
-  MCSymbol *TmpSym = Asm->GetTempSymbol(SymbolStem);
-  Asm->OutStreamer.EmitLabel(TmpSym);
-  return TmpSym;
-}
-
 /// EmitSectionLabels - Emit initial Dwarf sections with a label at
 /// the start of each one.
 void DwarfDebug::EmitSectionLabels() {
index d5ce6969e8b12140f571e51929c6273e5ee7429b..7bcc5b4207435c25b2995a531e0878fbbe2a3df8 100644 (file)
@@ -513,6 +513,10 @@ public:
   /// getStringPoolEntry - returns an entry into the string pool with the given
   /// string text.
   MCSymbol *getStringPoolEntry(StringRef Str);
+
+  /// getDwarfStrSectionSym - returns the symbol that starts the dwarf string
+  /// section.
+  MCSymbol *getDwarfStrSectionSym();
 };
 } // End of namespace llvm