summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/patches/patch-r262261-llvm-r200376-sparc.diff
blob: c24ea253d65abd8d5cca285f1cec67acd36bf2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Pull in r200376 from upstream llvm trunk (by Venkatraman Govindaraju):

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

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

Introduced here: http://svnweb.freebsd.org/changeset/base/262261

Index: lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
===================================================================
--- lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
+++ lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
@@ -26,6 +26,10 @@ class SparcELFMCAsmInfo : public MCAsmInfoELF {
   virtual const MCExpr* getExprForPersonalitySymbol(const MCSymbol *Sym,
                                                     unsigned Encoding,
                                                     MCStreamer &Streamer) const;
+  virtual const MCExpr* getExprForFDESymbol(const MCSymbol *Sym,
+                                            unsigned Encoding,
+                                            MCStreamer &Streamer) const;
+
 };
 
 } // namespace llvm
Index: lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
===================================================================
--- lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
+++ lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
@@ -58,3 +58,15 @@ SparcELFMCAsmInfo::getExprForPersonalitySymbol(con
 
   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);
+}
Index: test/CodeGen/SPARC/exception.ll
===================================================================
--- test/CodeGen/SPARC/exception.ll
+++ test/CodeGen/SPARC/exception.ll
@@ -57,6 +57,7 @@
 ; V8PIC_NOCFI:        .section .eh_frame
 ; V8PIC_NOCFI-NOT:    .section
 ; V8PIC_NOCFI:        .word %r_disp32(DW.ref.__gxx_personality_v0)
+; V8PIC_NOCFI:        .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
 
 
 ; V9ABS-LABEL: main:
@@ -94,6 +95,7 @@
 ; V9PIC_NOCFI:        .section .eh_frame
 ; V9PIC_NOCFI-NOT:    .section
 ; 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 {
 entry:
Index: include/llvm/MC/MCAsmInfo.h
===================================================================
--- include/llvm/MC/MCAsmInfo.h
+++ include/llvm/MC/MCAsmInfo.h
@@ -371,7 +371,7 @@ namespace llvm {
                                 unsigned Encoding,
                                 MCStreamer &Streamer) const;
 
-    const MCExpr *
+    virtual const MCExpr *
     getExprForFDESymbol(const MCSymbol *Sym,
                         unsigned Encoding,
                         MCStreamer &Streamer) const;
OpenPOWER on IntegriCloud