@@ -128,7 +128,7 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
128128 bool EnableRelax = STI.hasFeature (LoongArch::FeatureRelax);
129129 const MCExpr *Expr = MO.getExpr ();
130130 MCExpr::ExprKind Kind = Expr->getKind ();
131- LoongArch::Fixups FixupKind = LoongArch::fixup_loongarch_invalid;
131+ unsigned FixupKind = LoongArch::fixup_loongarch_invalid;
132132 if (Kind == MCExpr::Target) {
133133 const LoongArchMCExpr *LAExpr = cast<LoongArchMCExpr>(Expr);
134134
@@ -163,142 +163,142 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
163163 FixupKind = LoongArch::fixup_loongarch_abs64_hi12;
164164 break ;
165165 case LoongArchMCExpr::VK_PCALA_HI20:
166- FixupKind = LoongArch::fixup_loongarch_pcala_hi20 ;
166+ FixupKind = ELF::R_LARCH_PCALA_HI20 ;
167167 break ;
168168 case LoongArchMCExpr::VK_PCALA_LO12:
169- FixupKind = LoongArch::fixup_loongarch_pcala_lo12 ;
169+ FixupKind = ELF::R_LARCH_PCALA_LO12 ;
170170 break ;
171171 case LoongArchMCExpr::VK_PCALA64_LO20:
172- FixupKind = LoongArch::fixup_loongarch_pcala64_lo20 ;
172+ FixupKind = ELF::R_LARCH_PCALA64_LO20 ;
173173 break ;
174174 case LoongArchMCExpr::VK_PCALA64_HI12:
175- FixupKind = LoongArch::fixup_loongarch_pcala64_hi12 ;
175+ FixupKind = ELF::R_LARCH_PCALA64_HI12 ;
176176 break ;
177177 case LoongArchMCExpr::VK_GOT_PC_HI20:
178- FixupKind = LoongArch::fixup_loongarch_got_pc_hi20 ;
178+ FixupKind = ELF::R_LARCH_GOT_PC_HI20 ;
179179 break ;
180180 case LoongArchMCExpr::VK_GOT_PC_LO12:
181- FixupKind = LoongArch::fixup_loongarch_got_pc_lo12 ;
181+ FixupKind = ELF::R_LARCH_GOT_PC_LO12 ;
182182 break ;
183183 case LoongArchMCExpr::VK_GOT64_PC_LO20:
184- FixupKind = LoongArch::fixup_loongarch_got64_pc_lo20 ;
184+ FixupKind = ELF::R_LARCH_GOT64_PC_LO20 ;
185185 break ;
186186 case LoongArchMCExpr::VK_GOT64_PC_HI12:
187- FixupKind = LoongArch::fixup_loongarch_got64_pc_hi12 ;
187+ FixupKind = ELF::R_LARCH_GOT64_PC_HI12 ;
188188 break ;
189189 case LoongArchMCExpr::VK_GOT_HI20:
190- FixupKind = LoongArch::fixup_loongarch_got_hi20 ;
190+ FixupKind = ELF::R_LARCH_GOT_HI20 ;
191191 break ;
192192 case LoongArchMCExpr::VK_GOT_LO12:
193- FixupKind = LoongArch::fixup_loongarch_got_lo12 ;
193+ FixupKind = ELF::R_LARCH_GOT_LO12 ;
194194 break ;
195195 case LoongArchMCExpr::VK_GOT64_LO20:
196- FixupKind = LoongArch::fixup_loongarch_got64_lo20 ;
196+ FixupKind = ELF::R_LARCH_GOT64_LO20 ;
197197 break ;
198198 case LoongArchMCExpr::VK_GOT64_HI12:
199- FixupKind = LoongArch::fixup_loongarch_got64_hi12 ;
199+ FixupKind = ELF::R_LARCH_GOT64_HI12 ;
200200 break ;
201201 case LoongArchMCExpr::VK_TLS_LE_HI20:
202- FixupKind = LoongArch::fixup_loongarch_tls_le_hi20 ;
202+ FixupKind = ELF::R_LARCH_TLS_LE_HI20 ;
203203 break ;
204204 case LoongArchMCExpr::VK_TLS_LE_LO12:
205- FixupKind = LoongArch::fixup_loongarch_tls_le_lo12 ;
205+ FixupKind = ELF::R_LARCH_TLS_LE_LO12 ;
206206 break ;
207207 case LoongArchMCExpr::VK_TLS_LE64_LO20:
208- FixupKind = LoongArch::fixup_loongarch_tls_le64_lo20 ;
208+ FixupKind = ELF::R_LARCH_TLS_LE64_LO20 ;
209209 break ;
210210 case LoongArchMCExpr::VK_TLS_LE64_HI12:
211- FixupKind = LoongArch::fixup_loongarch_tls_le64_hi12 ;
211+ FixupKind = ELF::R_LARCH_TLS_LE64_HI12 ;
212212 break ;
213213 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 ;
215215 break ;
216216 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 ;
218218 break ;
219219 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 ;
221221 break ;
222222 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 ;
224224 break ;
225225 case LoongArchMCExpr::VK_TLS_IE_HI20:
226- FixupKind = LoongArch::fixup_loongarch_tls_ie_hi20 ;
226+ FixupKind = ELF::R_LARCH_TLS_IE_HI20 ;
227227 break ;
228228 case LoongArchMCExpr::VK_TLS_IE_LO12:
229- FixupKind = LoongArch::fixup_loongarch_tls_ie_lo12 ;
229+ FixupKind = ELF::R_LARCH_TLS_IE_LO12 ;
230230 break ;
231231 case LoongArchMCExpr::VK_TLS_IE64_LO20:
232- FixupKind = LoongArch::fixup_loongarch_tls_ie64_lo20 ;
232+ FixupKind = ELF::R_LARCH_TLS_IE64_LO20 ;
233233 break ;
234234 case LoongArchMCExpr::VK_TLS_IE64_HI12:
235- FixupKind = LoongArch::fixup_loongarch_tls_ie64_hi12 ;
235+ FixupKind = ELF::R_LARCH_TLS_IE64_HI12 ;
236236 break ;
237237 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 ;
239239 break ;
240240 case LoongArchMCExpr::VK_TLS_LD_HI20:
241- FixupKind = LoongArch::fixup_loongarch_tls_ld_hi20 ;
241+ FixupKind = ELF::R_LARCH_TLS_LD_HI20 ;
242242 break ;
243243 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 ;
245245 break ;
246246 case LoongArchMCExpr::VK_TLS_GD_HI20:
247- FixupKind = LoongArch::fixup_loongarch_tls_gd_hi20 ;
247+ FixupKind = ELF::R_LARCH_TLS_GD_HI20 ;
248248 break ;
249249 case LoongArchMCExpr::VK_CALL36:
250- FixupKind = LoongArch::fixup_loongarch_call36 ;
250+ FixupKind = ELF::R_LARCH_CALL36 ;
251251 RelaxCandidate = true ;
252252 break ;
253253 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 ;
255255 break ;
256256 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 ;
258258 break ;
259259 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 ;
261261 break ;
262262 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 ;
264264 break ;
265265 case LoongArchMCExpr::VK_TLS_DESC_HI20:
266- FixupKind = LoongArch::fixup_loongarch_tls_desc_hi20 ;
266+ FixupKind = ELF::R_LARCH_TLS_DESC_HI20 ;
267267 break ;
268268 case LoongArchMCExpr::VK_TLS_DESC_LO12:
269- FixupKind = LoongArch::fixup_loongarch_tls_desc_lo12 ;
269+ FixupKind = ELF::R_LARCH_TLS_DESC_LO12 ;
270270 break ;
271271 case LoongArchMCExpr::VK_TLS_DESC64_LO20:
272- FixupKind = LoongArch::fixup_loongarch_tls_desc64_lo20 ;
272+ FixupKind = ELF::R_LARCH_TLS_DESC64_LO20 ;
273273 break ;
274274 case LoongArchMCExpr::VK_TLS_DESC64_HI12:
275- FixupKind = LoongArch::fixup_loongarch_tls_desc64_hi12 ;
275+ FixupKind = ELF::R_LARCH_TLS_DESC64_HI12 ;
276276 break ;
277277 case LoongArchMCExpr::VK_TLS_DESC_LD:
278- FixupKind = LoongArch::fixup_loongarch_tls_desc_ld ;
278+ FixupKind = ELF::R_LARCH_TLS_DESC_LD ;
279279 break ;
280280 case LoongArchMCExpr::VK_TLS_DESC_CALL:
281- FixupKind = LoongArch::fixup_loongarch_tls_desc_call ;
281+ FixupKind = ELF::R_LARCH_TLS_DESC_CALL ;
282282 break ;
283283 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 ;
285285 RelaxCandidate = true ;
286286 break ;
287287 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 ;
289289 RelaxCandidate = true ;
290290 break ;
291291 case LoongArchMCExpr::VK_PCREL20_S2:
292- FixupKind = LoongArch::fixup_loongarch_pcrel20_s2 ;
292+ FixupKind = ELF::R_LARCH_PCREL20_S2 ;
293293 break ;
294294 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 ;
296296 break ;
297297 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 ;
299299 break ;
300300 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 ;
302302 break ;
303303 }
304304 } else if (Kind == MCExpr::SymbolRef &&
@@ -338,8 +338,8 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
338338 // hint.
339339 if (EnableRelax && RelaxCandidate) {
340340 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 ()));
343343 }
344344
345345 return 0 ;
@@ -388,15 +388,14 @@ void LoongArchMCCodeEmitter::expandAddTPRel(const MCInst &MI,
388388 " Expected %le_add_r relocation on TP-relative symbol" );
389389
390390 // 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 ()));
394393
395394 // Emit R_LARCH_RELAX for %le_add_r when the relax feature is enabled.
396395 if (STI.hasFeature (LoongArch::FeatureRelax)) {
397396 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 ()));
400399 }
401400
402401 // Emit a normal ADD instruction with the given operands.
0 commit comments