Skip to content

Commit 2c69a09

Browse files
authored
[NFC][sanitizer] Move ThreadDescriptorSize into GLIBC/FREEBSD block (#108913)
1 parent f4fe26d commit 2c69a09

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ void InitTlsSize() {}
244244
// On glibc x86_64, ThreadDescriptorSize() needs to be precise due to the usage
245245
// of g_tls_size. On other targets, ThreadDescriptorSize() is only used by lsan
246246
// to get the pointer to thread-specific data keys in the thread control block.
247-
# if (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_SOLARIS) && \
248-
!SANITIZER_ANDROID && !SANITIZER_GO
247+
# if (SANITIZER_FREEBSD || SANITIZER_GLIBC) && !SANITIZER_GO
249248
// sizeof(struct pthread) from glibc.
250249
static atomic_uintptr_t thread_descriptor_size;
251250

251+
// FIXME: Implementation is very GLIBC specific, but it's used by FREEBSD.
252252
static uptr ThreadDescriptorSizeFallback() {
253253
# if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
254254
int major;
@@ -363,6 +363,10 @@ static uptr TlsPreTcbSize() {
363363
}
364364
# endif
365365

366+
# endif
367+
368+
# if (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_SOLARIS) && \
369+
!SANITIZER_ANDROID && !SANITIZER_GO
366370
namespace {
367371
struct TlsBlock {
368372
uptr begin, end, align;

0 commit comments

Comments
 (0)