[Sparc] Use %r_disp32 for pc_rel entries in FDE as well.

This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200376 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Venkatraman Govindaraju 2014-01-29 06:59:20 +00:00
parent 52de969206
commit 99c3e481f3
4 changed files with 19 additions and 1 deletions

View File

@ -364,7 +364,7 @@ namespace llvm {
unsigned Encoding, unsigned Encoding,
MCStreamer &Streamer) const; MCStreamer &Streamer) const;
const MCExpr * virtual const MCExpr *
getExprForFDESymbol(const MCSymbol *Sym, getExprForFDESymbol(const MCSymbol *Sym,
unsigned Encoding, unsigned Encoding,
MCStreamer &Streamer) const; MCStreamer &Streamer) const;

View File

@ -56,3 +56,15 @@ SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer); return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
} }
const MCExpr*
SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
unsigned Encoding,
MCStreamer &Streamer) const {
if (Encoding & dwarf::DW_EH_PE_pcrel) {
MCContext &Ctx = Streamer.getContext();
return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
}
return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
}

View File

@ -26,6 +26,10 @@ public:
virtual const MCExpr* getExprForPersonalitySymbol(const MCSymbol *Sym, virtual const MCExpr* getExprForPersonalitySymbol(const MCSymbol *Sym,
unsigned Encoding, unsigned Encoding,
MCStreamer &Streamer) const; MCStreamer &Streamer) const;
virtual const MCExpr* getExprForFDESymbol(const MCSymbol *Sym,
unsigned Encoding,
MCStreamer &Streamer) const;
}; };
} // namespace llvm } // namespace llvm

View File

@ -57,6 +57,7 @@
; V8PIC_NOCFI: .section .eh_frame ; V8PIC_NOCFI: .section .eh_frame
; V8PIC_NOCFI-NOT: .section ; V8PIC_NOCFI-NOT: .section
; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0) ; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
; V8PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
; V9ABS-LABEL: main: ; V9ABS-LABEL: main:
@ -94,6 +95,7 @@
; V9PIC_NOCFI: .section .eh_frame ; V9PIC_NOCFI: .section .eh_frame
; V9PIC_NOCFI-NOT: .section ; V9PIC_NOCFI-NOT: .section
; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0) ; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
; V9PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 { define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
entry: entry: