summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-05-02 15:49:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-05-02 15:49:52 +0000
commite4066709547bd590a102da8f2af9fbe8b38a9f0f (patch)
tree17094538a1e89d9e6802a18a895c397060cbae61 /llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
parenta39247586528d41a2b44e3ed713d4e4a92c142f8 (diff)
downloadbcm5719-llvm-e4066709547bd590a102da8f2af9fbe8b38a9f0f.tar.gz
bcm5719-llvm-e4066709547bd590a102da8f2af9fbe8b38a9f0f.zip
Only produce the eh_frame section if we have at least one personality function.
llvm-svn: 130692
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
index 49680ad3089..dbd52c4981b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
@@ -54,25 +54,27 @@ void DwarfCFIException::EndModule() {
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());
}
}
OpenPOWER on IntegriCloud