[llvm] r179220 - Track the compact unwind encoding for when we are unable to generate compact unwind information.
Bill Wendling
wendling at apple.com
Wed Apr 10 14:51:09 PDT 2013
So...basically, we should still emit a compact unwind encoding thing if we need to generate an EH frame. The encoding in that case will indicate this.
-bw
On Apr 10, 2013, at 2:42 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Wed Apr 10 16:42:06 2013
> New Revision: 179220
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179220&view=rev
> Log:
> Track the compact unwind encoding for when we are unable to generate compact unwind information.
>
> Compact unwind has an encoding for when we're not able to generate compact
> unwind and must generate an EH frame instead. Track that, but still emit that CU
> encoding.
>
> 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=179220&r1=179219&r2=179220&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
> +++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Wed Apr 10 16:42:06 2013
> @@ -46,10 +46,15 @@ protected:
> unsigned FDEEncoding;
> unsigned FDECFIEncoding;
> unsigned TTypeEncoding;
> - // Section flags for eh_frame
> +
> + /// Section flags for eh_frame
> unsigned EHSectionType;
> unsigned EHSectionFlags;
>
> + /// CompactUnwindDwarfEHFrameOnly - Compact unwind encoding indicating that we
> + /// should emit only an EH frame.
> + unsigned CompactUnwindDwarfEHFrameOnly;
> +
> /// TextSection - Section directive for standard text.
> ///
> const MCSection *TextSection;
> @@ -201,6 +206,10 @@ public:
> }
> unsigned getTTypeEncoding() const { return TTypeEncoding; }
>
> + unsigned getCompactUnwindDwarfEHFrameOnly() const {
> + return CompactUnwindDwarfEHFrameOnly;
> + }
> +
> const MCSection *getTextSection() const { return TextSection; }
> const MCSection *getDataSection() const { return DataSection; }
> const MCSection *getBSSSection() const { return BSSSection; }
>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=179220&r1=179219&r2=179220&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Apr 10 16:42:06 2013
> @@ -1168,10 +1168,10 @@ bool FrameEmitterImpl::EmitCompactUnwind
> // .quad except_tab1
>
> uint32_t Encoding = Frame.CompactUnwindEncoding;
> - if (!Encoding) return false;
> + bool DwarfEHFrameOnly = (Encoding == MOFI->getCompactUnwindDwarfEHFrameOnly());
>
> // The encoding needs to know we have an LSDA.
> - if (Frame.Lsda)
> + if (!DwarfEHFrameOnly && Frame.Lsda)
> Encoding |= 0x40000000;
>
> Streamer.SwitchSection(MOFI->getCompactUnwindSection());
> @@ -1194,11 +1194,10 @@ bool FrameEmitterImpl::EmitCompactUnwind
> Twine::utohexstr(Encoding));
> Streamer.EmitIntValue(Encoding, Size);
>
> -
> // Personality Function
> Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_absptr);
> if (VerboseAsm) Streamer.AddComment("Personality Function");
> - if (Frame.Personality)
> + if (!DwarfEHFrameOnly && Frame.Personality)
> Streamer.EmitSymbolValue(Frame.Personality, Size);
> else
> Streamer.EmitIntValue(0, Size); // No personality fn
> @@ -1206,7 +1205,7 @@ bool FrameEmitterImpl::EmitCompactUnwind
> // LSDA
> Size = getSizeForEncoding(Streamer, Frame.LsdaEncoding);
> if (VerboseAsm) Streamer.AddComment("LSDA");
> - if (Frame.Lsda)
> + if (!DwarfEHFrameOnly && Frame.Lsda)
> Streamer.EmitSymbolValue(Frame.Lsda, Size);
> else
> Streamer.EmitIntValue(0, Size); // No LSDA
>
> Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=179220&r1=179219&r2=179220&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Wed Apr 10 16:42:06 2013
> @@ -145,12 +145,16 @@ void MCObjectFileInfo::InitMachOMCObject
> LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
> SectionKind::getReadOnlyWithRel());
>
> - if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
> + if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6)) {
> CompactUnwindSection =
> Ctx->getMachOSection("__LD", "__compact_unwind",
> MCSectionMachO::S_ATTR_DEBUG,
> SectionKind::getReadOnly());
>
> + if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
> + CompactUnwindDwarfEHFrameOnly = 0x04000000;
> + }
> +
> // Debug Information.
> DwarfAccelNamesSection =
> Ctx->getMachOSection("__DWARF", "__apple_names",
> @@ -629,6 +633,8 @@ void MCObjectFileInfo::InitMCObjectFileI
> PersonalityEncoding = LSDAEncoding = FDEEncoding = FDECFIEncoding =
> TTypeEncoding = dwarf::DW_EH_PE_absptr;
>
> + CompactUnwindDwarfEHFrameOnly = 0;
> +
> EHFrameSection = 0; // Created on demand.
> CompactUnwindSection = 0; // Used only by selected targets.
> DwarfAccelNamesSection = 0; // Used only by selected targets.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list