[compiler-rt] r209279 - [sanitizer] define SANITIZER_X32 and use it in ThreadDescriptorSize; partially based on patch by H.J. Lu
Kostya Serebryany
kcc at google.com
Wed May 21 01:01:44 PDT 2014
Author: kcc
Date: Wed May 21 03:01:44 2014
New Revision: 209279
URL: http://llvm.org/viewvc/llvm-project?rev=209279&view=rev
Log:
[sanitizer] define SANITIZER_X32 and use it in ThreadDescriptorSize; partially based on patch by H.J. Lu
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=209279&r1=209278&r2=209279&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Wed May 21 03:01:44 2014
@@ -312,7 +312,9 @@ uptr ThreadDescriptorSize() {
int minor = internal_simple_strtoll(buf + 8, &end, 10);
if (end != buf + 8 && (*end == '\0' || *end == '.')) {
/* sizeof(struct thread) values from various glibc versions. */
- if (minor <= 3)
+ if (SANITIZER_X32)
+ val = 1728; // Assume only one particular version for x32.
+ else if (minor <= 3)
val = FIRST_32_SECOND_64(1104, 1696);
else if (minor == 4)
val = FIRST_32_SECOND_64(1120, 1728);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=209279&r1=209278&r2=209279&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Wed May 21 03:01:44 2014
@@ -69,6 +69,12 @@
# define FIRST_32_SECOND_64(a, b) (a)
#endif
+#if defined(__x86_64__) && !defined(_LP64)
+# define SANITIZER_X32 1
+#else
+# define SANITIZER_X32 0
+#endif
+
// By default we allow to use SizeClassAllocator64 on 64-bit platform.
// But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64
// does not work well and we need to fallback to SizeClassAllocator32.
More information about the llvm-commits
mailing list