[llvm-commits] [llvm] r130692 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp

Rafael Espindola rafael.espindola at gmail.com
Mon May 2 08:49:52 PDT 2011


Author: rafael
Date: Mon May  2 10:49:52 2011
New Revision: 130692

URL: http://llvm.org/viewvc/llvm-project?rev=130692&view=rev
Log:
Only produce the eh_frame section if we have at least one personality function.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=130692&r1=130691&r2=130692&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Mon May  2 10:49:52 2011
@@ -54,25 +54,27 @@
 
   const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
 
-  if (!TLOF.isFunctionEHFrameSymbolPrivate()) {
-    // This is a temporary hack to keep sections in the same order they
-    // were before. This lets us produce bit identical outputs while
-    // transitioning to CFI.
-    Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
-  }
-
   unsigned PerEncoding = TLOF.getPersonalityEncoding();
 
   if ((PerEncoding & 0x70) != dwarf::DW_EH_PE_pcrel)
     return;
 
   // Emit references to all used personality functions
+  bool AtLeastOne = false;
   const std::vector<const Function*> &Personalities = MMI->getPersonalities();
   for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
     if (!Personalities[i])
       continue;
     MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
     TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
+    AtLeastOne = true;
+  }
+
+  if (AtLeastOne && !TLOF.isFunctionEHFrameSymbolPrivate()) {
+    // This is a temporary hack to keep sections in the same order they
+    // were before. This lets us produce bit identical outputs while
+    // transitioning to CFI.
+    Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
   }
 }
 





More information about the llvm-commits mailing list