This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] move tsan's Android __get_tls() to sanitizer_common
ClosedPublic

Authored by cryptoad on May 1 2017, 11:00 AM.

Details

Summary

TSan's Android __get_tls() and TLS_SLOT_TSAN can be used by other sanitizers as well (see D32649), this change moves them to sanitizer_common.
I picked sanitizer_linux.h as their new home.
In the process, add the 32-bit versions for ARM, i386 & MIPS.

Can the address of __get_tls()[TLS_SLOT_TSAN] change in between the calls?
I am not sure if there is a need to repeat the construct as opposed to using a variable. So I left things as they were.

Testing on my side was restricted to a successful cross-compilation.

Diff Detail

Event Timeline

cryptoad created this revision.May 1 2017, 11:00 AM
dvyukov added inline comments.May 2 2017, 4:56 AM
lib/sanitizer_common/sanitizer_linux.h
121

Please make it return &__get_tls()[TLS_SLOT_TSAN].
There is not need to spread TLS_SLOT_TSAN across sanitizers.

cryptoad updated this revision to Diff 97452.May 2 2017, 8:04 AM

As per Dmitry's request, make the function return &__get_tls()[TLS_SLOT_TSAN].

cryptoad marked an inline comment as done.May 2 2017, 8:05 AM
dvyukov accepted this revision.May 2 2017, 8:07 AM

Thanks!

This revision is now accepted and ready to land.May 2 2017, 8:07 AM
cryptoad closed this revision.May 2 2017, 8:26 AM