Skip to content

Commit f74ad7a

Browse files
committed
Revert "Delete the wrong flag NEEDS_TLSGD_TO_IE in the extreme code model."
This reverts commit baee006.
1 parent 36e42bf commit f74ad7a

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

lld/ELF/Relocations.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,17 +1453,7 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
14531453
// label, so TLSDESC=>IE will be categorized as R_RELAX_TLS_GD_TO_LE. We fix
14541454
// the categorization in RISCV::relocateAllosec->
14551455
if (sym.isPreemptible) {
1456-
// In LoongArch, TLSDESC code sequences share relocations
1457-
// R_LARCH_TLS_DESC_PC_HI20 and R_LARCH_TLS_DESC_PC_LO12 in
1458-
// normal/medium/extreme code model. Since the extreme code model cannot
1459-
// be optimized to IE/LE, the flag NEEDS_TLSGD_TO_IE added previously
1460-
// needs to be cleared.
1461-
// In extreme code model, R_LARCH_TLS_DESC64_LO20 and
1462-
// R_LARCH_TLS_DESC64_HI12 will set NEEDS_TLSDESC flag.
1463-
if (ctx.arg.emachine == EM_LOONGARCH && sym.hasFlag(NEEDS_TLSDESC))
1464-
sym.clearFlags(NEEDS_TLSGD_TO_IE);
1465-
else
1466-
sym.setFlags(NEEDS_TLSGD_TO_IE);
1456+
sym.setFlags(NEEDS_TLSGD_TO_IE);
14671457
sec->addReloc({ctx.target->adjustTlsExpr(type, R_RELAX_TLS_GD_TO_IE),
14681458
type, offset, addend, &sym});
14691459
} else {

lld/ELF/Symbols.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,6 @@ class Symbol {
342342
void setFlags(uint16_t bits) {
343343
flags.fetch_or(bits, std::memory_order_relaxed);
344344
}
345-
void clearFlags(uint16_t bits) {
346-
flags.fetch_and(~bits, std::memory_order_relaxed);
347-
}
348345
bool hasFlag(uint16_t bit) const {
349346
assert(llvm::has_single_bit(bit) && "bit must be a power of 2");
350347
return flags.load(std::memory_order_relaxed) & bit;

0 commit comments

Comments
 (0)