diff options
author | Logan Chien <loganchien@google.com> | 2012-09-05 23:37:51 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2012-10-15 13:32:03 +0800 |
commit | f95e4ad7086b245d10f2ea157ee3b548dd0aa4b7 (patch) | |
tree | 517f55f3db33c961754cf111b2bab4c8ac50fb91 | |
parent | 21ad5f2bc8b9594057e2dfe3bcbd5b8c97ec4eb9 (diff) | |
download | llvm-f95e4ad7086b245d10f2ea157ee3b548dd0aa4b7.tar.gz |
Fix ARM EHABI exception support.
-rw-r--r-- | lib/CodeGen/AsmPrinter/ARMException.cpp | 36 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfException.cpp | 15 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfException.h | 6 |
3 files changed, 41 insertions, 16 deletions
diff --git a/lib/CodeGen/AsmPrinter/ARMException.cpp b/lib/CodeGen/AsmPrinter/ARMException.cpp index b60fda86a6b..9e2f59e5a1b 100644 --- a/lib/CodeGen/AsmPrinter/ARMException.cpp +++ b/lib/CodeGen/AsmPrinter/ARMException.cpp @@ -71,24 +71,38 @@ void ARMException::EndFunction() { Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end", Asm->getFunctionNumber())); - // Emit references to personality. - if (const Function * Personality = - MMI->getPersonalities()[MMI->getPersonalityIndex()]) { - MCSymbol *PerSym = Asm->Mang->getSymbol(Personality); - Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global); - Asm->OutStreamer.EmitPersonality(PerSym); - } - if (EnableARMEHABIDescriptors) { // Map all labels and get rid of any dead landing pads. MMI->TidyLandingPads(); - Asm->OutStreamer.EmitHandlerData(); + const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads(); + + if (!PadInfos.empty()) { + // Emit references to personality. + if (const Function * Personality = + MMI->getPersonalities()[MMI->getPersonalityIndex()]) { + MCSymbol *PerSym = Asm->Mang->getSymbol(Personality); + Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global); + Asm->OutStreamer.EmitPersonality(PerSym); + } + + // Emit .handlerdata directive. + Asm->OutStreamer.EmitHandlerData(); - // Emit actual exception table - EmitExceptionTable(); + // Emit actual exception table + EmitExceptionTable(); + } } } Asm->OutStreamer.EmitFnEnd(); } + +void ARMException::EmitTypeInfoReference(const GlobalVariable *GV, + unsigned TTypeEncoding) { + if (GV) { + Asm->OutStreamer.EmitRawText("\t.word\t" + GV->getName() + "(TARGET2)\n"); + } else { + Asm->OutStreamer.EmitRawText(Twine("\t.word\t0\n")); + } +} diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 70cc2e56b3e..7d58102f5ba 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -684,11 +684,7 @@ void DwarfException::EmitExceptionTable() { const GlobalVariable *GV = *I; if (VerboseAsm) Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--)); - if (GV) - Asm->EmitReference(GV, TTypeEncoding); - else - Asm->OutStreamer.EmitIntValue(0,Asm->GetSizeOfEncodedValue(TTypeEncoding), - 0); + EmitTypeInfoReference(GV, TTypeEncoding); } // Emit the Exception Specifications. @@ -712,6 +708,15 @@ void DwarfException::EmitExceptionTable() { Asm->EmitAlignment(2); } +void DwarfException::EmitTypeInfoReference(const GlobalVariable *GV, + unsigned TTypeEncoding) { + if (GV) + Asm->EmitReference(GV, TTypeEncoding); + else + Asm->OutStreamer.EmitIntValue(0,Asm->GetSizeOfEncodedValue(TTypeEncoding), + 0); +} + /// EndModule - Emit all exception information that should come after the /// content. void DwarfException::EndModule() { diff --git a/lib/CodeGen/AsmPrinter/DwarfException.h b/lib/CodeGen/AsmPrinter/DwarfException.h index b5f86ab1b95..f361d3601ea 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.h +++ b/lib/CodeGen/AsmPrinter/DwarfException.h @@ -138,6 +138,9 @@ public: /// EndFunction - Gather and emit post-function exception information. virtual void EndFunction(); + + virtual void EmitTypeInfoReference(const GlobalVariable *GV, + unsigned TTypeEncoding); }; class DwarfCFIException : public DwarfException { @@ -203,6 +206,9 @@ public: /// EndFunction - Gather and emit post-function exception information. virtual void EndFunction(); + + virtual void EmitTypeInfoReference(const GlobalVariable *GV, + unsigned TTypeEncoding); }; class Win64Exception : public DwarfException { |