From bfa27cc5d72e061a96efbb461864d40bc8089ec2 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 28 Apr 2011 16:09:09 +0000 Subject: Add a getExprForPersonalitySymbol method to MCAsmInfo. Use it when converting the symbol passed to .cfi_personality into bytes is the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130400 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCAsmInfoDarwin.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/MC/MCAsmInfoDarwin.cpp') diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp index 526ad0da42..04862fae16 100644 --- a/lib/MC/MCAsmInfoDarwin.cpp +++ b/lib/MC/MCAsmInfoDarwin.cpp @@ -13,6 +13,9 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCAsmInfoDarwin.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCStreamer.h" using namespace llvm; MCAsmInfoDarwin::MCAsmInfoDarwin() { @@ -57,3 +60,13 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() { DwarfUsesLabelOffsetForRanges = false; } +const MCExpr * +MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym, + MCStreamer &Streamer) const { + MCContext &Context = Streamer.getContext(); + const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context); + MCSymbol *PCSym = Context.CreateTempSymbol(); + Streamer.EmitLabel(PCSym); + const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context); + return MCBinaryExpr::CreateSub(Res, PC, Context); +} -- cgit v1.2.3-18-g5258