Skip to content

Commit 20b544c

Browse files
committed
modify RE_LOONGARCH_GOT.
1 parent d17de78 commit 20b544c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lld/ELF/Relocations.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,14 +1462,6 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
14621462
return ctx.target->getTlsGdRelaxSkip(type);
14631463
}
14641464

1465-
// LoongArch TLS GD/LD relocs reuse the RE_LOONGARCH_TLSGD_PAGE_PC, in which
1466-
// NEEDS_TLSIE shouldn't set. So we check independently.
1467-
if (ctx.arg.emachine == EM_LOONGARCH && expr == RE_LOONGARCH_GOT &&
1468-
execOptimize && isLocalInExecutable) {
1469-
sec->addReloc({R_RELAX_TLS_IE_TO_LE, type, offset, addend, &sym});
1470-
return 1;
1471-
}
1472-
14731465
if (oneof<R_GOT, R_GOTPLT, R_GOT_PC, RE_AARCH64_GOT_PAGE_PC,
14741466
RE_LOONGARCH_GOT_PAGE_PC, R_GOT_OFF, R_TLSIE_HINT>(expr)) {
14751467
ctx.hasTlsIe.store(true, std::memory_order_relaxed);
@@ -1489,6 +1481,15 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
14891481
return 1;
14901482
}
14911483

1484+
// LoongArch TLS GD/LD relocs reuse the RE_LOONGARCH_GOT, in which
1485+
// NEEDS_TLSIE shouldn't set. So we check independently.
1486+
if (ctx.arg.emachine == EM_LOONGARCH && expr == RE_LOONGARCH_GOT &&
1487+
execOptimize && isLocalInExecutable) {
1488+
ctx.hasTlsIe.store(true, std::memory_order_relaxed);
1489+
sec->addReloc({R_RELAX_TLS_IE_TO_LE, type, offset, addend, &sym});
1490+
return 1;
1491+
}
1492+
14921493
return 0;
14931494
}
14941495

0 commit comments

Comments
 (0)