File tree Expand file tree Collapse file tree 3 files changed +12
-45
lines changed
llvm/lib/Target/VE/MCTargetDesc Expand file tree Collapse file tree 3 files changed +12
-45
lines changed Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
+ #include " MCTargetDesc/VEMCExpr.h"
9
10
#include " VEFixupKinds.h"
10
11
#include " VEMCExpr.h"
11
12
#include " VEMCTargetDesc.h"
@@ -39,6 +40,17 @@ class VEELFObjectWriter : public MCELFObjectTargetWriter {
39
40
unsigned VEELFObjectWriter::getRelocType (MCContext &Ctx, const MCValue &Target,
40
41
const MCFixup &Fixup,
41
42
bool IsPCRel) const {
43
+ switch (Target.getRefKind ()) {
44
+ case VEMCExpr::VK_TLS_GD_HI32:
45
+ case VEMCExpr::VK_TLS_GD_LO32:
46
+ case VEMCExpr::VK_TPOFF_HI32:
47
+ case VEMCExpr::VK_TPOFF_LO32:
48
+ if (auto *S = Target.getSymA ())
49
+ cast<MCSymbolELF>(S->getSymbol ()).setType (ELF::STT_TLS);
50
+ break ;
51
+ default :
52
+ break ;
53
+ }
42
54
if (const VEMCExpr *SExpr = dyn_cast<VEMCExpr>(Fixup.getValue ())) {
43
55
if (SExpr->getSpecifier () == VEMCExpr::VK_PC_LO32)
44
56
return ELF::R_VE_PC_LO32;
Original file line number Diff line number Diff line change @@ -86,49 +86,6 @@ bool VEMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
86
86
return true ;
87
87
}
88
88
89
- static void fixELFSymbolsInTLSFixupsImpl (const MCExpr *Expr, MCAssembler &Asm) {
90
- switch (Expr->getKind ()) {
91
- case MCExpr::Target:
92
- llvm_unreachable (" Can't handle nested target expr!" );
93
- break ;
94
-
95
- case MCExpr::Constant:
96
- break ;
97
-
98
- case MCExpr::Binary: {
99
- const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
100
- fixELFSymbolsInTLSFixupsImpl (BE->getLHS (), Asm);
101
- fixELFSymbolsInTLSFixupsImpl (BE->getRHS (), Asm);
102
- break ;
103
- }
104
-
105
- case MCExpr::SymbolRef: {
106
- // We're known to be under a TLS fixup, so any symbol should be
107
- // modified. There should be only one.
108
- const MCSymbolRefExpr &SymRef = *cast<MCSymbolRefExpr>(Expr);
109
- cast<MCSymbolELF>(SymRef.getSymbol ()).setType (ELF::STT_TLS);
110
- break ;
111
- }
112
-
113
- case MCExpr::Unary:
114
- fixELFSymbolsInTLSFixupsImpl (cast<MCUnaryExpr>(Expr)->getSubExpr (), Asm);
115
- break ;
116
- }
117
- }
118
-
119
89
void VEMCExpr::visitUsedExpr (MCStreamer &Streamer) const {
120
90
Streamer.visitUsedExpr (*getSubExpr ());
121
91
}
122
-
123
- void VEMCExpr::fixELFSymbolsInTLSFixups (MCAssembler &Asm) const {
124
- switch (getSpecifier ()) {
125
- default :
126
- return ;
127
- case VK_TLS_GD_HI32:
128
- case VK_TLS_GD_LO32:
129
- case VK_TPOFF_HI32:
130
- case VK_TPOFF_LO32:
131
- break ;
132
- }
133
- fixELFSymbolsInTLSFixupsImpl (getSubExpr (), Asm);
134
- }
Original file line number Diff line number Diff line change @@ -77,8 +77,6 @@ class VEMCExpr : public MCTargetExpr {
77
77
return getSubExpr ()->findAssociatedFragment ();
78
78
}
79
79
80
- void fixELFSymbolsInTLSFixups (MCAssembler &Asm) const override ;
81
-
82
80
static bool classof (const MCExpr *E) {
83
81
return E->getKind () == MCExpr::Target;
84
82
}
You can’t perform that action at this time.
0 commit comments