From 3786ae5c5453669f34aa10d444f5d7162cc6fd93 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 3 Jun 2013 10:20:23 +0000 Subject: [PATCH] [sanitizer] Fix kThreadDescriptorSize for glibc <= 2.11. Address issue reported by Greg Fitzgerald. llvm-svn: 183098 --- compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc index cdc30ccba250..fe8e67d331df 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -195,7 +195,13 @@ uptr GetTlsSize() { #if defined(__x86_64__) || defined(__i386__) // sizeof(struct thread) from glibc. +// There has been a report of this being different on glibc 2.11. We don't know +// when this change happened, so 2.12 is a conservative estimate. +#if __GNUC_PREREQ(2, 12) const uptr kThreadDescriptorSize = FIRST_32_SECOND_64(1216, 2304); +#else +const uptr kThreadDescriptorSize = FIRST_32_SECOND_64(1168, 2304); +#endif uptr ThreadDescriptorSize() { return kThreadDescriptorSize;