@@ -181,27 +181,26 @@ const char *getEdgeKindName(Edge::Kind K);
181
181
// / Apply fixup expression for edge to block content.
182
182
inline Error applyFixup (LinkGraph &G, Block &B, const Edge &E,
183
183
const Symbol *GOTSymbol) {
184
- using namespace i386 ;
185
184
using namespace llvm ::support;
186
185
187
186
char *BlockWorkingMem = B.getAlreadyMutableContent ().data ();
188
187
char *FixupPtr = BlockWorkingMem + E.getOffset ();
189
188
auto FixupAddress = B.getAddress () + E.getOffset ();
190
189
191
190
switch (E.getKind ()) {
192
- case i386:: Pointer32: {
191
+ case Pointer32: {
193
192
uint32_t Value = E.getTarget ().getAddress ().getValue () + E.getAddend ();
194
193
*(ulittle32_t *)FixupPtr = Value;
195
194
break ;
196
195
}
197
196
198
- case i386:: PCRel32: {
197
+ case PCRel32: {
199
198
int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
200
199
*(little32_t *)FixupPtr = Value;
201
200
break ;
202
201
}
203
202
204
- case i386:: Pointer16: {
203
+ case Pointer16: {
205
204
uint32_t Value = E.getTarget ().getAddress ().getValue () + E.getAddend ();
206
205
if (LLVM_LIKELY (isUInt<16 >(Value)))
207
206
*(ulittle16_t *)FixupPtr = Value;
@@ -210,7 +209,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
210
209
break ;
211
210
}
212
211
213
- case i386:: PCRel16: {
212
+ case PCRel16: {
214
213
int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
215
214
if (LLVM_LIKELY (isInt<16 >(Value)))
216
215
*(little16_t *)FixupPtr = Value;
@@ -219,23 +218,23 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
219
218
break ;
220
219
}
221
220
222
- case i386:: Delta32: {
221
+ case Delta32: {
223
222
int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
224
223
*(little32_t *)FixupPtr = Value;
225
224
break ;
226
225
}
227
226
228
- case i386:: Delta32FromGOT: {
227
+ case Delta32FromGOT: {
229
228
assert (GOTSymbol && " No GOT section symbol" );
230
229
int32_t Value =
231
230
E.getTarget ().getAddress () - GOTSymbol->getAddress () + E.getAddend ();
232
231
*(little32_t *)FixupPtr = Value;
233
232
break ;
234
233
}
235
234
236
- case i386:: BranchPCRel32:
237
- case i386:: BranchPCRel32ToPtrJumpStub:
238
- case i386:: BranchPCRel32ToPtrJumpStubBypassable: {
235
+ case BranchPCRel32:
236
+ case BranchPCRel32ToPtrJumpStub:
237
+ case BranchPCRel32ToPtrJumpStubBypassable: {
239
238
int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
240
239
*(little32_t *)FixupPtr = Value;
241
240
break ;
@@ -321,14 +320,14 @@ class GOTTableManager : public TableManager<GOTTableManager> {
321
320
bool visitEdge (LinkGraph &G, Block *B, Edge &E) {
322
321
Edge::Kind KindToSet = Edge::Invalid;
323
322
switch (E.getKind ()) {
324
- case i386:: Delta32FromGOT: {
323
+ case Delta32FromGOT: {
325
324
// we need to make sure that the GOT section exists, but don't otherwise
326
325
// need to fix up this edge
327
326
getGOTSection (G);
328
327
return false ;
329
328
}
330
- case i386:: RequestGOTAndTransformToDelta32FromGOT:
331
- KindToSet = i386:: Delta32FromGOT;
329
+ case RequestGOTAndTransformToDelta32FromGOT:
330
+ KindToSet = Delta32FromGOT;
332
331
break ;
333
332
default :
334
333
return false ;
@@ -367,15 +366,15 @@ class PLTTableManager : public TableManager<PLTTableManager> {
367
366
static StringRef getSectionName () { return " $__STUBS" ; }
368
367
369
368
bool visitEdge (LinkGraph &G, Block *B, Edge &E) {
370
- if (E.getKind () == i386:: BranchPCRel32 && !E.getTarget ().isDefined ()) {
369
+ if (E.getKind () == BranchPCRel32 && !E.getTarget ().isDefined ()) {
371
370
DEBUG_WITH_TYPE (" jitlink" , {
372
371
dbgs () << " Fixing " << G.getEdgeKindName (E.getKind ()) << " edge at "
373
372
<< B->getFixupAddress (E) << " (" << B->getAddress () << " + "
374
373
<< formatv (" {0:x}" , E.getOffset ()) << " )\n " ;
375
374
});
376
375
// Set the edge kind to Branch32ToPtrJumpStubBypassable to enable it to
377
376
// be optimized when the target is in-range.
378
- E.setKind (i386:: BranchPCRel32ToPtrJumpStubBypassable);
377
+ E.setKind (BranchPCRel32ToPtrJumpStubBypassable);
379
378
E.setTarget (getEntryForTarget (G, E.getTarget ()));
380
379
return true ;
381
380
}
0 commit comments