1 Pull in r200376 from upstream llvm trunk (by Venkatraman Govindaraju):
3 [Sparc] Use %r_disp32 for pc_rel entries in FDE as well.
5 This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo.
7 Introduced here: http://svn.freebsd.org/changeset/base/262261
9 Index: lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
10 ===================================================================
11 --- lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
12 +++ lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
13 @@ -26,6 +26,10 @@ class SparcELFMCAsmInfo : public MCAsmInfoELF {
14 virtual const MCExpr* getExprForPersonalitySymbol(const MCSymbol *Sym,
16 MCStreamer &Streamer) const;
17 + virtual const MCExpr* getExprForFDESymbol(const MCSymbol *Sym,
19 + MCStreamer &Streamer) const;
24 Index: lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
25 ===================================================================
26 --- lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
27 +++ lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
28 @@ -58,3 +58,15 @@ SparcELFMCAsmInfo::getExprForPersonalitySymbol(con
30 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
34 +SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
36 + MCStreamer &Streamer) const {
37 + if (Encoding & dwarf::DW_EH_PE_pcrel) {
38 + MCContext &Ctx = Streamer.getContext();
39 + return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
40 + MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
42 + return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
44 Index: test/CodeGen/SPARC/exception.ll
45 ===================================================================
46 --- test/CodeGen/SPARC/exception.ll
47 +++ test/CodeGen/SPARC/exception.ll
49 ; V8PIC_NOCFI: .section .eh_frame
50 ; V8PIC_NOCFI-NOT: .section
51 ; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
52 +; V8PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
57 ; V9PIC_NOCFI: .section .eh_frame
58 ; V9PIC_NOCFI-NOT: .section
59 ; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
60 +; V9PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
62 define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
64 Index: include/llvm/MC/MCAsmInfo.h
65 ===================================================================
66 --- include/llvm/MC/MCAsmInfo.h
67 +++ include/llvm/MC/MCAsmInfo.h
68 @@ -371,7 +371,7 @@ namespace llvm {
70 MCStreamer &Streamer) const;
73 + virtual const MCExpr *
74 getExprForFDESymbol(const MCSymbol *Sym,
76 MCStreamer &Streamer) const;