This is an archive of the discontinued LLVM Phabricator instance.

[elf2] Implement global dynamic tls.
ClosedPublic

Authored by Bigcheese on Nov 11 2015, 2:05 PM.

Details

Diff Detail

Event Timeline

Bigcheese updated this revision to Diff 39972.Nov 11 2015, 2:05 PM
Bigcheese retitled this revision from to [elf2] Implement global dynamic tls..
Bigcheese updated this object.
Bigcheese added reviewers: rafael, ruiu, davide.
Bigcheese added a subscriber: llvm-commits.
ruiu added inline comments.Nov 11 2015, 2:39 PM
ELF/InputSection.cpp
129

You are not using a return value of getTlsGlobalDynamicReloc except comparing it with Type. Isn't isTlsGlobalDynamicReloc(uint32_t) better than getTlsGlobalDynamicReloc()?

ELF/OutputSections.cpp
210–212

(PNext) -> PNext

emaste added a subscriber: emaste.Nov 11 2015, 9:32 PM
rafael added inline comments.Nov 12 2015, 3:58 PM
ELF/OutputSections.cpp
182–188

Add a comment about this being a placeholder for the second entry in a gd pair (which was handled in the previous iteration.

Bigcheese updated this revision to Diff 40095.Nov 12 2015, 4:09 PM
Bigcheese marked an inline comment as done.
Bigcheese added inline comments.
ELF/InputSection.cpp
129

Probably. We would need to change getTlsLocalDynamicReloc too.

rafael accepted this revision.Nov 12 2015, 4:20 PM
rafael edited edge metadata.

LGTM, but please change getTlsLocalDynamicReloc to isTlsLocalDynamicReloc (and global equivalent) in a followup commit.

This revision is now accepted and ready to land.Nov 12 2015, 4:20 PM
ruiu accepted this revision.Nov 12 2015, 4:30 PM
ruiu edited edge metadata.

LGTM

grimar added a subscriber: grimar.Nov 13 2015, 2:46 AM
grimar added inline comments.
ELF/OutputSections.cpp
86

Probably would be better to make another method for that case because it is still possible for symbol to be TLS but consume only one GOT entry. I fixed this for my patch:
http://reviews.llvm.org/D14621

185

I would use && here, its more strict check. There should be no other cases when one of these is null but other is not.
More strict way would be to have some static relocation used as allowed stub:

static DynamicReloc<ELFT> TlsDynamicRelocationPlaceholder;
...
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
Out<ELFT>::RelaDyn->addReloc(TlsDynamicRelocationPlaceholder);
...
 if (&Rel == &TlsDynamicRelocationPlaceholder)
      continue;
test/elf2/tls-dynamic.s
75

Its not visible here but tabs are used instead of spaces in test in few places. Other tests dont has tabs I think.

davide closed this revision.Jan 11 2016, 7:05 PM
davide edited edge metadata.

Close, this is was committed.