[all-commits] [llvm/llvm-project] 031c40: [sanitizer] Fix glibc sparc build and add GetTls s...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Apr 20 17:42:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 031c40dc3c71e1e08d0c459b81fc6b54184cec58
      https://github.com/llvm/llvm-project/commit/031c40dc3c71e1e08d0c459b81fc6b54184cec58
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-04-20 (Tue, 20 Apr 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

  Log Message:
  -----------
  [sanitizer] Fix glibc sparc build and add GetTls support

sanitizer_linux_libcdep.cpp doesn't build for Linux sparc (with minimum support
but can build) after D98926. I wasn't aware because the file didn't mention
`__sparc__`.

While here, add the relevant support since it does not add complexity
(the D99566 approach).  Adds an explicit `#error` for unsupported
non-Android Linux and FreeBSD architectures.

ThreadDescriptorSize is only used by lsan to scan thread-specific data keys in
the thread control block.

On TLS Variant II architectures (i386/x86_64/s390/sparc), our dl_iterate_phdr
based approach can cover the region from the first byte of the static TLS block
(static TLS surplus) to the thread pointer.
We just need to extend the range to include the first few members of struct
pthread. offsetof(struct pthread, specific_used) satisfies the requirement and
has not changed since 2007-05-10. We don't need to update ThreadDescriptorSize
for each glibc version.

Technically we could use the 524/1552 for x86_64 as well but there is potential
risk that large applications with thousands of shared object dependency may
dislike the time complexity increase if there are many threads, so I don't make
the simplification for now.

Differential Revision: https://reviews.llvm.org/D100892




More information about the All-commits mailing list