From 33cc7a8f74f558970c7b94a079141470b6110c9b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 10 May 2011 13:39:48 +0000 Subject: [PATCH] Add CFIStartSections to the asm printer. Add an assert that at least one of the sections is created. llvm-svn: 131124 --- lib/MC/MCAsmStreamer.cpp | 19 +++++++++++++++++++ lib/MC/MCStreamer.cpp | 1 + 2 files changed, 20 insertions(+) diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index c7fc190b876..603ae837b6d 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -193,6 +193,7 @@ public: unsigned Isa, unsigned Discriminator, StringRef FileName); + virtual void EmitCFISections(bool EH, bool Debug); virtual void EmitCFIStartProc(); virtual void EmitCFIEndProc(); virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset); @@ -764,6 +765,24 @@ void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, EmitEOL(); } +void MCAsmStreamer::EmitCFISections(bool EH, bool Debug) { + MCStreamer::EmitCFISections(EH, Debug); + + if (!UseCFI) + return; + + OS << "\t.cfi_sections "; + if (EH) { + OS << ".eh_frame"; + if (Debug) + OS << ", .debug_frame"; + } else if (Debug) { + OS << ".debug_frame"; + } + + EmitEOL(); +} + void MCAsmStreamer::EmitCFIStartProc() { MCStreamer::EmitCFIStartProc(); diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 689e408a1a0..9b644a91bd9 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -178,6 +178,7 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) { } void MCStreamer::EmitCFISections(bool EH, bool Debug) { + assert(EH || Debug); EmitEHFrame = EH; EmitDebugFrame = Debug; }