[llvm] r205087 - MC-exceptions: add support for compact-unwind without .eh_frame
Tim Northover
tnorthover at apple.com
Sat Mar 29 02:03:14 PDT 2014
Author: tnorthover
Date: Sat Mar 29 04:03:13 2014
New Revision: 205087
URL: http://llvm.org/viewvc/llvm-project?rev=205087&view=rev
Log:
MC-exceptions: add support for compact-unwind without .eh_frame
ARM64 has compact-unwind information, but doesn't necessarily want to
emit .eh_frame directives as well. This teaches MC about such a
situation so that it will skip .eh_frame info when compact unwind has
been successfully produced.
For functions incompatible with compact unwind, the normal information
is still written.
Modified:
llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
llvm/trunk/lib/MC/MCDwarf.cpp
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=205087&r1=205086&r2=205087&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Sat Mar 29 04:03:13 2014
@@ -39,6 +39,11 @@ protected:
/// non-.globl label. This defaults to true.
bool IsFunctionEHFrameSymbolPrivate;
+ /// SupportsCompactUnwindWithoutEHFrame - True if the target object file
+ /// supports emitting a compact unwind section without an associated EH frame
+ /// section.
+ bool SupportsCompactUnwindWithoutEHFrame;
+
/// PersonalityEncoding, LSDAEncoding, FDEEncoding, TTypeEncoding - Some
/// encoding values for EH.
unsigned PersonalityEncoding;
@@ -203,6 +208,9 @@ public:
bool getSupportsWeakOmittedEHFrame() const {
return SupportsWeakOmittedEHFrame;
}
+ bool getSupportsCompactUnwindWithoutEHFrame() const {
+ return SupportsCompactUnwindWithoutEHFrame;
+ }
bool getCommDirectiveSupportsAlignment() const {
return CommDirectiveSupportsAlignment;
}
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=205087&r1=205086&r2=205087&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Sat Mar 29 04:03:13 2014
@@ -1502,6 +1502,7 @@ void MCDwarfFrameEmitter::Emit(MCStreame
ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
// Emit the compact unwind info if available.
+ bool NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
if (IsEH && MOFI->getCompactUnwindSection()) {
bool SectionEmitted = false;
for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
@@ -1512,13 +1513,19 @@ void MCDwarfFrameEmitter::Emit(MCStreame
Streamer.EmitValueToAlignment(Context.getAsmInfo()->getPointerSize());
SectionEmitted = true;
}
+ NeedsEHFrameSection |=
+ Frame.CompactUnwindEncoding ==
+ MOFI->getCompactUnwindDwarfEHFrameOnly();
Emitter.EmitCompactUnwind(Streamer, Frame);
}
}
+ if (!NeedsEHFrameSection) return;
+
const MCSection &Section =
IsEH ? *const_cast<MCObjectFileInfo*>(MOFI)->getEHFrameSection() :
*MOFI->getDwarfFrameSection();
+
Streamer.SwitchSection(&Section);
MCSymbol *SectionStart = Context.CreateTempSymbol();
Streamer.EmitLabel(SectionStart);
@@ -1528,8 +1535,22 @@ void MCDwarfFrameEmitter::Emit(MCStreame
DenseMap<CIEKey, const MCSymbol*> CIEStarts;
const MCSymbol *DummyDebugKey = NULL;
+ NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
const MCDwarfFrameInfo &Frame = FrameArray[i];
+
+ // Emit the label from the previous iteration
+ if (FDEEnd) {
+ Streamer.EmitLabel(FDEEnd);
+ FDEEnd = NULL;
+ }
+
+ if (!NeedsEHFrameSection && Frame.CompactUnwindEncoding !=
+ MOFI->getCompactUnwindDwarfEHFrameOnly())
+ // Don't generate an EH frame if we don't need one. I.e., it's taken care
+ // of by the compact unwind encoding.
+ continue;
+
CIEKey Key(Frame.Personality, Frame.PersonalityEncoding,
Frame.LsdaEncoding, Frame.IsSignalFrame, Frame.IsSimple);
const MCSymbol *&CIEStart = IsEH ? CIEStarts[Key] : DummyDebugKey;
@@ -1541,9 +1562,6 @@ void MCDwarfFrameEmitter::Emit(MCStreame
Frame.IsSimple);
FDEEnd = Emitter.EmitFDE(Streamer, *CIEStart, Frame);
-
- if (i != n - 1)
- Streamer.EmitLabel(FDEEnd);
}
Streamer.EmitValueToAlignment(Context.getAsmInfo()->getPointerSize());
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=205087&r1=205086&r2=205087&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Sat Mar 29 04:03:13 2014
@@ -743,6 +743,7 @@ void MCObjectFileInfo::InitMCObjectFileI
CommDirectiveSupportsAlignment = true;
SupportsWeakOmittedEHFrame = true;
IsFunctionEHFrameSymbolPrivate = true;
+ SupportsCompactUnwindWithoutEHFrame = false;
PersonalityEncoding = LSDAEncoding = FDEEncoding = FDECFIEncoding =
TTypeEncoding = dwarf::DW_EH_PE_absptr;
More information about the llvm-commits
mailing list