@@ -128,7 +128,7 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
128
128
bool EnableRelax = STI.hasFeature (LoongArch::FeatureRelax);
129
129
const MCExpr *Expr = MO.getExpr ();
130
130
MCExpr::ExprKind Kind = Expr->getKind ();
131
- LoongArch::Fixups FixupKind = LoongArch::fixup_loongarch_invalid;
131
+ unsigned FixupKind = LoongArch::fixup_loongarch_invalid;
132
132
if (Kind == MCExpr::Target) {
133
133
const LoongArchMCExpr *LAExpr = cast<LoongArchMCExpr>(Expr);
134
134
@@ -163,142 +163,142 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
163
163
FixupKind = LoongArch::fixup_loongarch_abs64_hi12;
164
164
break ;
165
165
case LoongArchMCExpr::VK_PCALA_HI20:
166
- FixupKind = LoongArch::fixup_loongarch_pcala_hi20 ;
166
+ FixupKind = ELF::R_LARCH_PCALA_HI20 ;
167
167
break ;
168
168
case LoongArchMCExpr::VK_PCALA_LO12:
169
- FixupKind = LoongArch::fixup_loongarch_pcala_lo12 ;
169
+ FixupKind = ELF::R_LARCH_PCALA_LO12 ;
170
170
break ;
171
171
case LoongArchMCExpr::VK_PCALA64_LO20:
172
- FixupKind = LoongArch::fixup_loongarch_pcala64_lo20 ;
172
+ FixupKind = ELF::R_LARCH_PCALA64_LO20 ;
173
173
break ;
174
174
case LoongArchMCExpr::VK_PCALA64_HI12:
175
- FixupKind = LoongArch::fixup_loongarch_pcala64_hi12 ;
175
+ FixupKind = ELF::R_LARCH_PCALA64_HI12 ;
176
176
break ;
177
177
case LoongArchMCExpr::VK_GOT_PC_HI20:
178
- FixupKind = LoongArch::fixup_loongarch_got_pc_hi20 ;
178
+ FixupKind = ELF::R_LARCH_GOT_PC_HI20 ;
179
179
break ;
180
180
case LoongArchMCExpr::VK_GOT_PC_LO12:
181
- FixupKind = LoongArch::fixup_loongarch_got_pc_lo12 ;
181
+ FixupKind = ELF::R_LARCH_GOT_PC_LO12 ;
182
182
break ;
183
183
case LoongArchMCExpr::VK_GOT64_PC_LO20:
184
- FixupKind = LoongArch::fixup_loongarch_got64_pc_lo20 ;
184
+ FixupKind = ELF::R_LARCH_GOT64_PC_LO20 ;
185
185
break ;
186
186
case LoongArchMCExpr::VK_GOT64_PC_HI12:
187
- FixupKind = LoongArch::fixup_loongarch_got64_pc_hi12 ;
187
+ FixupKind = ELF::R_LARCH_GOT64_PC_HI12 ;
188
188
break ;
189
189
case LoongArchMCExpr::VK_GOT_HI20:
190
- FixupKind = LoongArch::fixup_loongarch_got_hi20 ;
190
+ FixupKind = ELF::R_LARCH_GOT_HI20 ;
191
191
break ;
192
192
case LoongArchMCExpr::VK_GOT_LO12:
193
- FixupKind = LoongArch::fixup_loongarch_got_lo12 ;
193
+ FixupKind = ELF::R_LARCH_GOT_LO12 ;
194
194
break ;
195
195
case LoongArchMCExpr::VK_GOT64_LO20:
196
- FixupKind = LoongArch::fixup_loongarch_got64_lo20 ;
196
+ FixupKind = ELF::R_LARCH_GOT64_LO20 ;
197
197
break ;
198
198
case LoongArchMCExpr::VK_GOT64_HI12:
199
- FixupKind = LoongArch::fixup_loongarch_got64_hi12 ;
199
+ FixupKind = ELF::R_LARCH_GOT64_HI12 ;
200
200
break ;
201
201
case LoongArchMCExpr::VK_TLS_LE_HI20:
202
- FixupKind = LoongArch::fixup_loongarch_tls_le_hi20 ;
202
+ FixupKind = ELF::R_LARCH_TLS_LE_HI20 ;
203
203
break ;
204
204
case LoongArchMCExpr::VK_TLS_LE_LO12:
205
- FixupKind = LoongArch::fixup_loongarch_tls_le_lo12 ;
205
+ FixupKind = ELF::R_LARCH_TLS_LE_LO12 ;
206
206
break ;
207
207
case LoongArchMCExpr::VK_TLS_LE64_LO20:
208
- FixupKind = LoongArch::fixup_loongarch_tls_le64_lo20 ;
208
+ FixupKind = ELF::R_LARCH_TLS_LE64_LO20 ;
209
209
break ;
210
210
case LoongArchMCExpr::VK_TLS_LE64_HI12:
211
- FixupKind = LoongArch::fixup_loongarch_tls_le64_hi12 ;
211
+ FixupKind = ELF::R_LARCH_TLS_LE64_HI12 ;
212
212
break ;
213
213
case LoongArchMCExpr::VK_TLS_IE_PC_HI20:
214
- FixupKind = LoongArch::fixup_loongarch_tls_ie_pc_hi20 ;
214
+ FixupKind = ELF::R_LARCH_TLS_IE_PC_HI20 ;
215
215
break ;
216
216
case LoongArchMCExpr::VK_TLS_IE_PC_LO12:
217
- FixupKind = LoongArch::fixup_loongarch_tls_ie_pc_lo12 ;
217
+ FixupKind = ELF::R_LARCH_TLS_IE_PC_LO12 ;
218
218
break ;
219
219
case LoongArchMCExpr::VK_TLS_IE64_PC_LO20:
220
- FixupKind = LoongArch::fixup_loongarch_tls_ie64_pc_lo20 ;
220
+ FixupKind = ELF::R_LARCH_TLS_IE64_PC_LO20 ;
221
221
break ;
222
222
case LoongArchMCExpr::VK_TLS_IE64_PC_HI12:
223
- FixupKind = LoongArch::fixup_loongarch_tls_ie64_pc_hi12 ;
223
+ FixupKind = ELF::R_LARCH_TLS_IE64_PC_HI12 ;
224
224
break ;
225
225
case LoongArchMCExpr::VK_TLS_IE_HI20:
226
- FixupKind = LoongArch::fixup_loongarch_tls_ie_hi20 ;
226
+ FixupKind = ELF::R_LARCH_TLS_IE_HI20 ;
227
227
break ;
228
228
case LoongArchMCExpr::VK_TLS_IE_LO12:
229
- FixupKind = LoongArch::fixup_loongarch_tls_ie_lo12 ;
229
+ FixupKind = ELF::R_LARCH_TLS_IE_LO12 ;
230
230
break ;
231
231
case LoongArchMCExpr::VK_TLS_IE64_LO20:
232
- FixupKind = LoongArch::fixup_loongarch_tls_ie64_lo20 ;
232
+ FixupKind = ELF::R_LARCH_TLS_IE64_LO20 ;
233
233
break ;
234
234
case LoongArchMCExpr::VK_TLS_IE64_HI12:
235
- FixupKind = LoongArch::fixup_loongarch_tls_ie64_hi12 ;
235
+ FixupKind = ELF::R_LARCH_TLS_IE64_HI12 ;
236
236
break ;
237
237
case LoongArchMCExpr::VK_TLS_LD_PC_HI20:
238
- FixupKind = LoongArch::fixup_loongarch_tls_ld_pc_hi20 ;
238
+ FixupKind = ELF::R_LARCH_TLS_LD_PC_HI20 ;
239
239
break ;
240
240
case LoongArchMCExpr::VK_TLS_LD_HI20:
241
- FixupKind = LoongArch::fixup_loongarch_tls_ld_hi20 ;
241
+ FixupKind = ELF::R_LARCH_TLS_LD_HI20 ;
242
242
break ;
243
243
case LoongArchMCExpr::VK_TLS_GD_PC_HI20:
244
- FixupKind = LoongArch::fixup_loongarch_tls_gd_pc_hi20 ;
244
+ FixupKind = ELF::R_LARCH_TLS_GD_PC_HI20 ;
245
245
break ;
246
246
case LoongArchMCExpr::VK_TLS_GD_HI20:
247
- FixupKind = LoongArch::fixup_loongarch_tls_gd_hi20 ;
247
+ FixupKind = ELF::R_LARCH_TLS_GD_HI20 ;
248
248
break ;
249
249
case LoongArchMCExpr::VK_CALL36:
250
- FixupKind = LoongArch::fixup_loongarch_call36 ;
250
+ FixupKind = ELF::R_LARCH_CALL36 ;
251
251
RelaxCandidate = true ;
252
252
break ;
253
253
case LoongArchMCExpr::VK_TLS_DESC_PC_HI20:
254
- FixupKind = LoongArch::fixup_loongarch_tls_desc_pc_hi20 ;
254
+ FixupKind = ELF::R_LARCH_TLS_DESC_PC_HI20 ;
255
255
break ;
256
256
case LoongArchMCExpr::VK_TLS_DESC_PC_LO12:
257
- FixupKind = LoongArch::fixup_loongarch_tls_desc_pc_lo12 ;
257
+ FixupKind = ELF::R_LARCH_TLS_DESC_PC_LO12 ;
258
258
break ;
259
259
case LoongArchMCExpr::VK_TLS_DESC64_PC_LO20:
260
- FixupKind = LoongArch::fixup_loongarch_tls_desc64_pc_lo20 ;
260
+ FixupKind = ELF::R_LARCH_TLS_DESC64_PC_LO20 ;
261
261
break ;
262
262
case LoongArchMCExpr::VK_TLS_DESC64_PC_HI12:
263
- FixupKind = LoongArch::fixup_loongarch_tls_desc64_pc_hi12 ;
263
+ FixupKind = ELF::R_LARCH_TLS_DESC64_PC_HI12 ;
264
264
break ;
265
265
case LoongArchMCExpr::VK_TLS_DESC_HI20:
266
- FixupKind = LoongArch::fixup_loongarch_tls_desc_hi20 ;
266
+ FixupKind = ELF::R_LARCH_TLS_DESC_HI20 ;
267
267
break ;
268
268
case LoongArchMCExpr::VK_TLS_DESC_LO12:
269
- FixupKind = LoongArch::fixup_loongarch_tls_desc_lo12 ;
269
+ FixupKind = ELF::R_LARCH_TLS_DESC_LO12 ;
270
270
break ;
271
271
case LoongArchMCExpr::VK_TLS_DESC64_LO20:
272
- FixupKind = LoongArch::fixup_loongarch_tls_desc64_lo20 ;
272
+ FixupKind = ELF::R_LARCH_TLS_DESC64_LO20 ;
273
273
break ;
274
274
case LoongArchMCExpr::VK_TLS_DESC64_HI12:
275
- FixupKind = LoongArch::fixup_loongarch_tls_desc64_hi12 ;
275
+ FixupKind = ELF::R_LARCH_TLS_DESC64_HI12 ;
276
276
break ;
277
277
case LoongArchMCExpr::VK_TLS_DESC_LD:
278
- FixupKind = LoongArch::fixup_loongarch_tls_desc_ld ;
278
+ FixupKind = ELF::R_LARCH_TLS_DESC_LD ;
279
279
break ;
280
280
case LoongArchMCExpr::VK_TLS_DESC_CALL:
281
- FixupKind = LoongArch::fixup_loongarch_tls_desc_call ;
281
+ FixupKind = ELF::R_LARCH_TLS_DESC_CALL ;
282
282
break ;
283
283
case LoongArchMCExpr::VK_TLS_LE_HI20_R:
284
- FixupKind = LoongArch::fixup_loongarch_tls_le_hi20_r ;
284
+ FixupKind = ELF::R_LARCH_TLS_LE_HI20_R ;
285
285
RelaxCandidate = true ;
286
286
break ;
287
287
case LoongArchMCExpr::VK_TLS_LE_LO12_R:
288
- FixupKind = LoongArch::fixup_loongarch_tls_le_lo12_r ;
288
+ FixupKind = ELF::R_LARCH_TLS_LE_LO12_R ;
289
289
RelaxCandidate = true ;
290
290
break ;
291
291
case LoongArchMCExpr::VK_PCREL20_S2:
292
- FixupKind = LoongArch::fixup_loongarch_pcrel20_s2 ;
292
+ FixupKind = ELF::R_LARCH_PCREL20_S2 ;
293
293
break ;
294
294
case LoongArchMCExpr::VK_TLS_LD_PCREL20_S2:
295
- FixupKind = LoongArch::fixup_loongarch_tls_ld_pcrel20_s2 ;
295
+ FixupKind = ELF::R_LARCH_TLS_LD_PCREL20_S2 ;
296
296
break ;
297
297
case LoongArchMCExpr::VK_TLS_GD_PCREL20_S2:
298
- FixupKind = LoongArch::fixup_loongarch_tls_gd_pcrel20_s2 ;
298
+ FixupKind = ELF::R_LARCH_TLS_GD_PCREL20_S2 ;
299
299
break ;
300
300
case LoongArchMCExpr::VK_TLS_DESC_PCREL20_S2:
301
- FixupKind = LoongArch::fixup_loongarch_tls_desc_pcrel20_s2 ;
301
+ FixupKind = ELF::R_LARCH_TLS_DESC_PCREL20_S2 ;
302
302
break ;
303
303
}
304
304
} else if (Kind == MCExpr::SymbolRef &&
@@ -338,8 +338,8 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
338
338
// hint.
339
339
if (EnableRelax && RelaxCandidate) {
340
340
const MCConstantExpr *Dummy = MCConstantExpr::create (0 , Ctx);
341
- Fixups.push_back (MCFixup::create (
342
- 0 , Dummy, MCFixupKind (LoongArch::fixup_loongarch_relax) , MI.getLoc ()));
341
+ Fixups.push_back (
342
+ MCFixup::create ( 0 , Dummy, ELF::R_LARCH_RELAX , MI.getLoc ()));
343
343
}
344
344
345
345
return 0 ;
@@ -388,15 +388,14 @@ void LoongArchMCCodeEmitter::expandAddTPRel(const MCInst &MI,
388
388
" Expected %le_add_r relocation on TP-relative symbol" );
389
389
390
390
// Emit the correct %le_add_r relocation for the symbol.
391
- Fixups.push_back (MCFixup::create (
392
- 0 , Expr, MCFixupKind (LoongArch::fixup_loongarch_tls_le_add_r),
393
- MI.getLoc ()));
391
+ Fixups.push_back (
392
+ MCFixup::create (0 , Expr, ELF::R_LARCH_TLS_LE_ADD_R, MI.getLoc ()));
394
393
395
394
// Emit R_LARCH_RELAX for %le_add_r when the relax feature is enabled.
396
395
if (STI.hasFeature (LoongArch::FeatureRelax)) {
397
396
const MCConstantExpr *Dummy = MCConstantExpr::create (0 , Ctx);
398
- Fixups.push_back (MCFixup::create (
399
- 0 , Dummy, MCFixupKind (LoongArch::fixup_loongarch_relax) , MI.getLoc ()));
397
+ Fixups.push_back (
398
+ MCFixup::create ( 0 , Dummy, ELF::R_LARCH_RELAX , MI.getLoc ()));
400
399
}
401
400
402
401
// Emit a normal ADD instruction with the given operands.
0 commit comments