@@ -1430,14 +1430,6 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
14301430 return ctx.target ->getTlsGdRelaxSkip (type);
14311431 }
14321432
1433- // LoongArch TLS GD/LD relocs reuse the RE_LOONGARCH_TLSGD_PAGE_PC, in which
1434- // NEEDS_TLSIE shouldn't set. So we check independently.
1435- if (ctx.arg .emachine == EM_LOONGARCH && expr == RE_LOONGARCH_GOT &&
1436- execOptimize && isLocalInExecutable) {
1437- sec->addReloc ({R_RELAX_TLS_IE_TO_LE, type, offset, addend, &sym});
1438- return 1 ;
1439- }
1440-
14411433 if (oneof<R_GOT, R_GOTPLT, R_GOT_PC, RE_AARCH64_GOT_PAGE_PC,
14421434 RE_LOONGARCH_GOT_PAGE_PC, R_GOT_OFF, R_TLSIE_HINT>(expr)) {
14431435 ctx.hasTlsIe .store (true , std::memory_order_relaxed);
@@ -1457,6 +1449,15 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
14571449 return 1 ;
14581450 }
14591451
1452+ // LoongArch TLS GD/LD relocs reuse the RE_LOONGARCH_GOT, in which
1453+ // NEEDS_TLSIE shouldn't set. So we check independently.
1454+ if (ctx.arg .emachine == EM_LOONGARCH && expr == RE_LOONGARCH_GOT &&
1455+ execOptimize && isLocalInExecutable) {
1456+ ctx.hasTlsIe .store (true , std::memory_order_relaxed);
1457+ sec->addReloc ({R_RELAX_TLS_IE_TO_LE, type, offset, addend, &sym});
1458+ return 1 ;
1459+ }
1460+
14601461 return 0 ;
14611462}
14621463
0 commit comments