[lld] [ELF] Fix TLS GD against non-preemptible dynamic symbols in DSOs (PR #207881)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 20:54:51 PDT 2026


MaskRay wrote:



> Sure, I'll try reworking the message tomorrow; my thoughts were definitely coming out jumbled with it being late at night (and this was the polished version of them...)

Thanks! Agreed with your rant about `DynamicReloc::getSymIndex`
https://reviews.llvm.org/D123985
```
uint32_t DynamicReloc::getSymIndex(SymbolTableBaseSection *symTab) const {
  if (!needsDynSymIndex())
    return 0;

  size_t index = symTab->getSymbolIndex(sym);
/// then I added `!symTab->ctx.in.dynSymTab->getParent()` to allow /DISCARD/ on .dymsym
  assert((index != 0 || type != target->gotRel && type != target->pltRel) &&
         "GOT or PLT relocation must refer to symbol in dynamic symbol table");
  return index;
}
```

https://github.com/llvm/llvm-project/pull/207881


More information about the llvm-commits mailing list