diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCAsmInfo.cpp | 6 | ||||
-rw-r--r-- | lib/MC/MCAsmInfoDarwin.cpp | 4 | ||||
-rw-r--r-- | lib/MC/MCDwarf.cpp | 21 |
3 files changed, 17 insertions, 14 deletions
diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp index 873802a..b685c1a 100644 --- a/lib/MC/MCAsmInfo.cpp +++ b/lib/MC/MCAsmInfo.cpp @@ -112,5 +112,11 @@ unsigned MCAsmInfo::getSLEB128Size(int Value) { const MCExpr * MCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym, MCStreamer &Streamer) const { + return getExprForFDESymbol(Sym, Streamer); +} + +const MCExpr * +MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, + MCStreamer &Streamer) const { return MCSymbolRefExpr::Create(Sym, Streamer.getContext()); } diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp index 04862fa..fea1548 100644 --- a/lib/MC/MCAsmInfoDarwin.cpp +++ b/lib/MC/MCAsmInfoDarwin.cpp @@ -61,8 +61,8 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() { } const MCExpr * -MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym, - MCStreamer &Streamer) const { +MCAsmInfoDarwin::getExprForFDESymbol(const MCSymbol *Sym, + MCStreamer &Streamer) const { MCContext &Context = Streamer.getContext(); const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context); MCSymbol *PCSym = Context.CreateTempSymbol(); diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index d677d0c..7111758 100644 --- a/lib/MC/MCDwarf.cpp +++ b/lib/MC/MCDwarf.cpp @@ -465,19 +465,16 @@ static unsigned getSizeForEncoding(MCStreamer &streamer, static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol, unsigned symbolEncoding) { + MCContext &context = streamer.getContext(); + const MCAsmInfo &asmInfo = context.getAsmInfo(); + const MCExpr *v = asmInfo.getExprForFDESymbol(&symbol, + streamer); unsigned size = getSizeForEncoding(streamer, symbolEncoding); unsigned application = symbolEncoding & 0x70; - switch (application) { - default: - assert(0 && "Unknown Encoding"); - break; - case 0: - streamer.EmitSymbolValue(&symbol, size); - break; - case dwarf::DW_EH_PE_pcrel: - streamer.EmitPCRelSymbolValue(&symbol, size); - break; - } + if (isa<MCSymbolRefExpr>(v) && application == dwarf::DW_EH_PE_pcrel) + streamer.EmitPCRelValue(v, size); + else + streamer.EmitAbsValue(v, size); } static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol, @@ -756,7 +753,7 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer, unsigned size = getSizeForEncoding(streamer, fdeEncoding); // PC Begin - streamer.EmitPCRelSymbolValue(frame.Begin, size); + EmitSymbol(streamer, *frame.Begin, fdeEncoding); // PC Range const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin, |