add a horrible hack to the dwarf printer. It looks like mingw is not specifying
authorChris Lattner <sabre@nondot.org>
Tue, 18 Aug 2009 06:13:03 +0000 (06:13 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 18 Aug 2009 06:13:03 +0000 (06:13 +0000)
an EHFrame section, so we just emit ehframe data into a random section.

This is clearly bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79323 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfException.cpp

index 1d773ee53e760e7982472d0c4a64a9f5e90268dd..7ab0bb0975a4622171b3ac1cd86dd21dfb70659b 100644 (file)
@@ -56,7 +56,10 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality,
     TD->getPointerSize() : -TD->getPointerSize();
 
   // Begin eh frame section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
+  // FIXME: THIS IS A HORRIBLE HACK.  MingW isn't specifying an EHFrame section.
+  if (const MCSection *EHFrameSec = 
+      Asm->getObjFileLowering().getEHFrameSection())
+    Asm->SwitchToSection(EHFrameSec);
 
   if (TAI->is_EHSymbolPrivate())
     O << TAI->getPrivateGlobalPrefix();
@@ -150,8 +153,11 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
 
   const Function *TheFunc = EHFrameInfo.function;
   
-  Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
-
+  // FIXME: THIS IS A HORRIBLE HACK.  MingW isn't specifying an EHFrame section.
+  if (const MCSection *EHFrameSec = 
+      Asm->getObjFileLowering().getEHFrameSection())
+    Asm->SwitchToSection(EHFrameSec);
+  
   // Externally visible entry into the functions eh frame info. If the
   // corresponding function is static, this should not be externally visible.
   if (!TheFunc->hasLocalLinkage())