Main aim of the patch to introduce basic support for TLS access models for x86 target.
Models using @tlsgd, @tlsldm and @gotntpoff are implemented.
There are no any TLS optimizations yet - I plan to add them in another following patches.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
ELF/OutputSections.cpp | ||
---|---|---|
84 ↗ | (On Diff #41356) | Thats needed for the next code sequence to work correctly: leal tls0@tlsgd(,%ebx,1),%eax call __tls_get_addr@plt movl %gs:0,%eax addl tls0@gotntpoff(%ebx),%eax @tlsgd(x) - Allocates two contiguous entries in the GOT to hold a TLS_index structure. Problem is that next part of code terminates execution flow: void Writer<ELFT>::scanRelocs( ..... if (Body && Body->isTLS() && Target->isTlsGlobalDynamicReloc(Type)) { if (Target->isTlsOptimized(Type, Body)) continue; if (Body->isInGot()) continue; Make it continue and unable to move forward and create R_386_TLS_TPOFF relocation (and single entry) below at the end of that method. |
ELF/OutputSections.cpp | ||
---|---|---|
84 ↗ | (On Diff #41356) | Understood, but can you do that in a different way? I think the new variable is rather confusing, since symbols added to GOT using addDynTlsEntry are in GOT, but isInGot returns false for them (although they are in GOT). |
ELF/OutputSections.cpp | ||
---|---|---|
84 ↗ | (On Diff #41356) | First of all: I reproduced the same situation on x64 target and decided to split patch for that from this one: http://reviews.llvm.org/D15105. About making that in a different way: But I dont see problem here for design. At fact we dont use isInGot() for GD reloc because it is special case and processed separately everywhere. So its even more confusing to have this to respond isInGot() call when this call looks like should never be used in according to current logic. I prepared that separate patch to make code look more consistent with code for LocalModuleTlsIndexOffset to hightlight their special nature (also updated a test case for x64 there). |
ELF/OutputSections.h | ||
126 ↗ | (On Diff #41356) | Will be fixed in update. |
ELF/Target.cpp | ||
350 ↗ | (On Diff #41356) | Will be fixed in update. |
ELF/OutputSections.cpp | ||
---|---|---|
84 ↗ | (On Diff #41356) | Mostly my concern is about the name isInGot(). If something is in GOT, that function should return true no matter how that is in GOT, because the function is named is-in-got. |
ELF/OutputSections.cpp | ||
---|---|---|
84 ↗ | (On Diff #41356) | There is no more that code in this patch :) It dissolved during other commits, so I guess its fine now. |