[lld] [PAC][ThinLTO] Fix auth key for GOT entries of function symbols (PR #131467)
Daniil Kovalev via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 14 06:45:23 PDT 2025
kovdan01 wrote:
> `elfSym.getName(obj->getStringTable())` is wasteful - as we could zip `obj->template getGlobalELFSyms<ELFT>()` with `obj->getGlobalSymbols()`.
@MaskRay Do I get your intention correct - you suggest to change this:
```
for (typename ELFT::Sym elfSym : obj->template getGlobalELFSyms<ELFT>()) {
StringRef elfSymName = check(elfSym.getName(obj->getStringTable()));
if (Symbol *sym = ctx.symtab->find(elfSymName))
if (sym->type == STT_NOTYPE)
sym->type = elfSym.getType();
}
```
to smth like this:
```
for (const Symbol *globSym : obj->getGlobalSymbols())
if (Symbol *sym = ctx.symtab->find(globSym->getName()))
if (sym->type == STT_NOTYPE)
sym->type = globSym->type;
```
If so, this does not look correct - function symbols from `obj->getGlobalSymbols()` will have `STT_NOTYPE` type, while corresponding ELF symbols will have `STT_FUNC` type. We want the latter behavior in order to change symbol type in symtab.
Please let me know if I misunderstood you.
https://github.com/llvm/llvm-project/pull/131467
More information about the llvm-commits
mailing list