[PATCH] D26238: [LLD][ARM] Correct ARM TLS GOT entries without dynamic relocations.

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 03:17:02 PST 2016


peter.smith added a comment.

Thanks very much for the comments.

I hope to rewrite this and my ifunc patch shortly using the refactored Input Sections.

I've been spending some time using lld on ARM as an ld replacement on a Chromebook running Ubuntu via crouton. Some of the programs I've not been able to execute without some instability problems after linking are the llvm-* tools such llvm-mc etc. One possible source of problems is TLS so I may not have got this completely right yet.



================
Comment at: ELF/OutputSections.cpp:394
+      if (B->IsTlsGotRel)
+        VA += alignTo(Target->TcbSize, Out<ELFT>::TlsPhdr->p_align);
+      uint8_t *Entry = Buf + B->GotIndex * sizeof(uintX_t);
----------------
rafael wrote:
> This is the same value as what R_TLS would compute, no?
> 
> now that the got is a synthetic section, it has a  Relocations array. Could we maybe use that instead of Entries?  So the code for having a non zero value in the got  would become something like
> 
>   In<ELFT>::Got.Relocations.push_back({R_ABS, Target->?, }Body.getGotPltOffset<ELFT>() , 0, &Body})
> 
>  Do you think that would be better? If not something like this (rebase now that .got is a synthetic section) is probably ok.
Yes that is correct. We are in effect resolving the relocation at static link time.

The difficulty with this approach at the time was how to avoid writing the relocation into the file as well as statically resolving it. I thought that this would probably be messier than localising it here. With the new refactoring this might be easier so it will be worth taking another look. 
   


https://reviews.llvm.org/D26238





More information about the llvm-commits mailing list