[PATCH] D91605: [sanitizers] Implement GetTls on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 02:28:05 PST 2020


ro created this revision.
ro added reviewers: vitalybuka, MaskRay.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, pengfei, fedor.sergeev, mgorny, jyknight.
Herald added a project: clang.
ro requested review of this revision.

In the initial Solaris ASan port, `GetTls` was left unimplemented.  This patch corrects that.  There are a couple of caveats, unfortunately:

While current Solaris 11.4 supports the `dlpi_tls_modid` field of `struct dl_phdr_info`, this was only added in SRU 10 and isn't present in either Solaris 11.3 or Illumos.  Instead, this uses a method used in GCC's D runtime library libphobos dlpi_tls_modid workaround <https://gcc.gnu.org/legacy-ml/gcc-patches/2019-04/msg00552.html> which works even on Solaris 10.

However, the direct call to `__tls_get_address` triggers a Solaris `ld` bug on amd64, which needs to be worked around the same way as in `libphobos`: ld workaround <https://gcc.gnu.org/legacy-ml/gcc-patches/2019-04/msg00356.html>.

Together, they allow the `sanitizer_common` TLS tests to `PASS` on both sparc and x86.
I've also verified that the patch doesn't break the Illumos build; however `compiler-rt` test results continue to be horrible there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91605

Files:
  clang/include/clang/Config/config.h.cmake
  clang/lib/Driver/ToolChains/Solaris.cpp
  clang/tools/driver/CMakeLists.txt
  compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91605.305706.patch
Type: text/x-patch
Size: 5441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/75232be5/attachment.bin>


More information about the llvm-commits mailing list