[PATCH] D74443: [lld][Hexagon] convert call x at GDPLT to call __tls_get_addr
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 01:08:00 PST 2020
grimar added inline comments.
================
Comment at: lld/ELF/Relocations.cpp:1986
+ OutputSections, [&](OutputSection *Os, InputSectionDescription *Isd) {
+ for (InputSection *Isec : Isd->sections)
+ for (Relocation &Rel : Isec->relocations)
----------------
I wonder if you could do the following?
```
bool hexagonNeedsTLSSymbol(...) {
for (InputSectionBase *s : inputSections)
if (s->isLive())
for (Relocation &Rel : Isec->relocations)
if (Rel.sym->type == llvm::ELF::STT_TLS && Rel.expr == R_PLT_PC)
return true;
return false;
}
```
================
Comment at: lld/ELF/Relocations.cpp:2003
+ if (Rel.sym->type == llvm::ELF::STT_TLS && Rel.expr == R_PLT_PC) {
+ Symbol *Sym = symtab->find("__tls_get_addr");
+ if (!Sym)
----------------
I think it is better to move this `find` call out of the loops.
================
Comment at: lld/ELF/Relocations.cpp:2005
+ if (!Sym)
+ error("unable to find __tls_get_addr");
+ if (NeedEntry) {
----------------
How can this error happen?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74443/new/
https://reviews.llvm.org/D74443
More information about the llvm-commits
mailing list