Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lld/ELF/Relocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
// label, so TLSDESC=>IE will be categorized as R_RELAX_TLS_GD_TO_LE. We fix
// the categorization in RISCV::relocateAllosec->
if (sym.isPreemptible) {
sym.setFlags(NEEDS_TLSGD_TO_IE);
sym.setFlags(NEEDS_TLSIE);
sec->addReloc({ctx.target->adjustTlsExpr(type, R_RELAX_TLS_GD_TO_IE),
type, offset, addend, &sym});
} else {
Expand Down Expand Up @@ -1635,18 +1635,13 @@ void elf::postScanRelocations(Ctx &ctx) {
else
got->addConstant({R_ABS, ctx.target->tlsOffsetRel, offsetOff, 0, &sym});
}
if (flags & NEEDS_TLSGD_TO_IE) {
got->addEntry(sym);
ctx.mainPart->relaDyn->addSymbolReloc(ctx.target->tlsGotRel, *got,
sym.getGotOffset(ctx), sym);
}
if (flags & NEEDS_GOT_DTPREL) {
got->addEntry(sym);
got->addConstant(
{R_ABS, ctx.target->tlsOffsetRel, sym.getGotOffset(ctx), 0, &sym});
}

if ((flags & NEEDS_TLSIE) && !(flags & NEEDS_TLSGD_TO_IE))
if (flags & NEEDS_TLSIE)
addTpOffsetGotEntry(ctx, sym);
};

Expand Down
4 changes: 2 additions & 2 deletions lld/ELF/Symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum {
NEEDS_COPY = 1 << 3,
NEEDS_TLSDESC = 1 << 4,
NEEDS_TLSGD = 1 << 5,
NEEDS_TLSGD_TO_IE = 1 << 6,
// 1 << 6 unused
NEEDS_GOT_DTPREL = 1 << 7,
NEEDS_TLSIE = 1 << 8,
NEEDS_GOT_AUTH = 1 << 9,
Expand Down Expand Up @@ -352,7 +352,7 @@ class Symbol {
bool needsDynReloc() const {
return flags.load(std::memory_order_relaxed) &
(NEEDS_COPY | NEEDS_GOT | NEEDS_PLT | NEEDS_TLSDESC | NEEDS_TLSGD |
NEEDS_TLSGD_TO_IE | NEEDS_GOT_DTPREL | NEEDS_TLSIE);
NEEDS_GOT_DTPREL | NEEDS_TLSIE);
}
void allocateAux(Ctx &ctx) {
assert(auxIdx == 0);
Expand Down
Loading