]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / patches / patch-r262261-llvm-r200376-sparc.diff
1 Pull in r200376 from upstream llvm trunk (by Venkatraman Govindaraju):
2
3   [Sparc] Use %r_disp32 for pc_rel entries in FDE as well.
4
5   This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo.
6
7 Introduced here: http://svnweb.freebsd.org/changeset/base/262261
8
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,
15                                                      unsigned Encoding,
16                                                      MCStreamer &Streamer) const;
17 +  virtual const MCExpr* getExprForFDESymbol(const MCSymbol *Sym,
18 +                                            unsigned Encoding,
19 +                                            MCStreamer &Streamer) const;
20 +
21  };
22  
23  } // namespace llvm
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
29  
30    return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
31  }
32 +
33 +const MCExpr*
34 +SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
35 +                                       unsigned Encoding,
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);
41 +  }
42 +  return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
43 +}
44 Index: test/CodeGen/SPARC/exception.ll
45 ===================================================================
46 --- test/CodeGen/SPARC/exception.ll
47 +++ test/CodeGen/SPARC/exception.ll
48 @@ -57,6 +57,7 @@
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
53  
54  
55  ; V9ABS-LABEL: main:
56 @@ -94,6 +95,7 @@
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
61  
62  define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
63  entry:
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 {
69                                  unsigned Encoding,
70                                  MCStreamer &Streamer) const;
71  
72 -    const MCExpr *
73 +    virtual const MCExpr *
74      getExprForFDESymbol(const MCSymbol *Sym,
75                          unsigned Encoding,
76                          MCStreamer &Streamer) const;