This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers] [PowerPC] Intercept __tls_get_addr_opt.
ClosedPublic

Authored by koriakin on Jun 19 2016, 2:16 PM.

Details

Summary

On PowerPC, if binutils and glibc are new enough, the linker uses
an optimized code sequence to implement tls_get_addr call stub,
which will end up calling
tls_get_addr_opt instead of tls_get_addr.
Thus, we need to intercept it in addition to
tls_get_addr.

This symbol is actually an alias of __tls_get_addr - its only purpose
is that its presence in glibc triggers the optimization in linker.
This means we can make our own intercepting symbol an alias as well.

This patch will make the linker attempt optimization even on older
glibc's (since it sees a defined __tls_get_addr_opt symbol in msan)

  • however, this is only a very minor performance problem (the linker

generated code will never recognize a filled static TLS descriptor,
always burning a few cycles), not a correctness problem.

This fixes MSan's dtls_test.c, allowing us to finally enable MSan
on PowerPC64.

Diff Detail

Repository
rL LLVM

Event Timeline

koriakin retitled this revision from to [sanitizers] [PowerPC] Intercept __tls_get_addr_opt..
koriakin updated this object.
koriakin added reviewers: kcc, eugenis.
koriakin set the repository for this revision to rL LLVM.
koriakin added a project: Restricted Project.
koriakin added a subscriber: llvm-commits.
aizatsky accepted this revision.Jun 20 2016, 3:16 PM
aizatsky added a reviewer: aizatsky.
aizatsky added a subscriber: aizatsky.
aizatsky added inline comments.
lib/sanitizer_common/sanitizer_common_interceptors.inc
4430

mostly

This revision is now accepted and ready to land.Jun 20 2016, 3:16 PM
koriakin closed this revision.Jun 21 2016, 12:17 AM

Commited in 273250