[lld] [lld][Hexagon] Fix TLS GD PLT to only create PLT entry for __tls_get_addr (PR #180297)
Brian Cain via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 18 10:21:50 PST 2026
================
@@ -181,10 +182,21 @@ void Hexagon::scanSectionImpl(InputSectionBase &sec, Relocs<RelTy> rels) {
continue;
case R_HEX_GD_PLT_B22_PCREL:
case R_HEX_GD_PLT_B22_PCREL_X:
- case R_HEX_GD_PLT_B32_PCREL_X:
- sym.setFlags(NEEDS_PLT);
- sec.addReloc({R_PLT_PC, type, offset, addend, &sym});
+ case R_HEX_GD_PLT_B32_PCREL_X: {
+ // GD PLT: call foo at GDPLT becomes call __tls_get_addr. Create the
+ // __tls_get_addr symbol if needed and route the PLT entry to it
+ // instead of the TLS symbol.
+ Symbol *ta = ctx.symtab->find("__tls_get_addr");
----------------
androm3da wrote:
Like so
```
void elf::postScanRelocations(Ctx &ctx) {
ctx.target->postScanRelocations();
bool needsTlsIe = false;
auto fn = [&](Symbol &sym) {
auto flags = sym.flags.load(std::memory_order_relaxed);
// ...
```
https://github.com/llvm/llvm-project/pull/180297
More information about the llvm-commits
mailing list