diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-10 20:59:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-10 20:59:42 +0000 |
commit | e3a0e987f3d4f07512cdb64b9034369f966cb448 (patch) | |
tree | 47dfd5d09bb3a6fb98af73df9c195f0141125f8f /lib | |
parent | dc52ecf6fdbee63652d2dac0dccc17e23ac7797f (diff) | |
download | external_llvm-e3a0e987f3d4f07512cdb64b9034369f966cb448.zip external_llvm-e3a0e987f3d4f07512cdb64b9034369f966cb448.tar.gz external_llvm-e3a0e987f3d4f07512cdb64b9034369f966cb448.tar.bz2 |
On MachO, unlike ELF, there should be no relocation to produce the CIE pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCDwarf.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index d0eaf20..7cf6cdd 100644 --- a/lib/MC/MCDwarf.cpp +++ b/lib/MC/MCDwarf.cpp @@ -502,11 +502,12 @@ namespace { int CIENum; bool UsingCFI; bool IsEH; + const MCSymbol *SectionStart; public: - FrameEmitterImpl(bool usingCFI, bool isEH) : CFAOffset(0), CIENum(0), - UsingCFI(usingCFI), - IsEH(isEH) { + FrameEmitterImpl(bool usingCFI, bool isEH, const MCSymbol *sectionStart) : + CFAOffset(0), CIENum(0), UsingCFI(usingCFI), IsEH(isEH), + SectionStart(sectionStart) { } const MCSymbol &EmitCIE(MCStreamer &streamer, @@ -737,9 +738,9 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer, MCContext &context = streamer.getContext(); MCSymbol *fdeStart = context.CreateTempSymbol(); MCSymbol *fdeEnd = context.CreateTempSymbol(); - const TargetAsmInfo &asmInfo = context.getTargetAsmInfo(); + const TargetAsmInfo &TAsmInfo = context.getTargetAsmInfo(); - if (!asmInfo.isFunctionEHFrameSymbolPrivate() && IsEH) { + if (!TAsmInfo.isFunctionEHFrameSymbolPrivate() && IsEH) { MCSymbol *EHSym = context.GetOrCreateSymbol( frame.Function->getName() + Twine(".eh")); streamer.EmitEHSymAttributes(frame.Function, EHSym); @@ -751,15 +752,21 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer, streamer.EmitAbsValue(Length, 4); streamer.EmitLabel(fdeStart); + // CIE Pointer + const MCAsmInfo &asmInfo = context.getAsmInfo(); if (IsEH) { const MCExpr *offset = MakeStartMinusEndExpr(streamer, cieStart, *fdeStart, 0); streamer.EmitAbsValue(offset, 4); + } else if (!asmInfo.doesDwarfRequireRelocationForSectionOffset()) { + const MCExpr *offset = MakeStartMinusEndExpr(streamer, *SectionStart, + cieStart, 0); + streamer.EmitAbsValue(offset, 4); } else { streamer.EmitSymbolValue(&cieStart, 4); } - unsigned fdeEncoding = asmInfo.getFDEEncoding(UsingCFI); + unsigned fdeEncoding = TAsmInfo.getFDEEncoding(UsingCFI); unsigned size = getSizeForEncoding(streamer, fdeEncoding); // PC Begin @@ -840,15 +847,17 @@ namespace llvm { void MCDwarfFrameEmitter::Emit(MCStreamer &streamer, bool usingCFI, bool isEH) { - const MCContext &context = streamer.getContext(); + MCContext &context = streamer.getContext(); const TargetAsmInfo &asmInfo = context.getTargetAsmInfo(); const MCSection §ion = isEH ? *asmInfo.getEHFrameSection() : *asmInfo.getDwarfFrameSection(); streamer.SwitchSection(§ion); + MCSymbol *SectionStart = context.CreateTempSymbol(); + streamer.EmitLabel(SectionStart); MCSymbol *fdeEnd = NULL; DenseMap<CIEKey, const MCSymbol*> CIEStarts; - FrameEmitterImpl Emitter(usingCFI, isEH); + FrameEmitterImpl Emitter(usingCFI, isEH, SectionStart); const MCSymbol *DummyDebugKey = NULL; for (unsigned i = 0, n = streamer.getNumFrameInfos(); i < n; ++i) { |