[llvm-branch-commits] [NFC][sanitizer] Remove #elif to simplify ThreadDescriptorSizeFallback (PR #108911)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Sep 16 19:20:42 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/108911.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp (+18-6)
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index a5101291904430..4ed8b4f0825bba 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -281,19 +281,27 @@ static uptr ThreadDescriptorSizeFallback() {
return FIRST_32_SECOND_64(1344, 2496);
}
return 0;
-# elif defined(__s390__) || defined(__sparc__)
+# endif
+
+# if defined(__s390__) || defined(__sparc__)
// The size of a prefix of TCB including pthread::{specific_1stblock,specific}
// suffices. Just return offsetof(struct pthread, specific_used), which hasn't
// changed since 2007-05. Technically this applies to i386/x86_64 as well but
// we call _dl_get_tls_static_info and need the precise size of struct
// pthread.
return FIRST_32_SECOND_64(524, 1552);
-# elif defined(__mips__)
+# endif
+
+# if defined(__mips__)
// TODO(sagarthakur): add more values as per different glibc versions.
return FIRST_32_SECOND_64(1152, 1776);
-# elif SANITIZER_LOONGARCH64
+# endif
+
+# if SANITIZER_LOONGARCH64
return 1856; // from glibc 2.36
-# elif SANITIZER_RISCV64
+# endif
+
+# if SANITIZER_RISCV64
int major;
int minor;
int patch;
@@ -307,10 +315,14 @@ static uptr ThreadDescriptorSizeFallback() {
return 1936; // tested against glibc 2.32
}
return 0;
-# elif defined(__aarch64__)
+# endif
+
+# if defined(__aarch64__)
// The sizeof (struct pthread) is the same from GLIBC 2.17 to 2.22.
return 1776;
-# elif defined(__powerpc64__)
+# endif
+
+# if defined(__powerpc64__)
return 1776; // from glibc.ppc64le 2.20-8.fc21
# endif
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/108911
More information about the llvm-branch-commits
mailing list