From baf90ccfaccfbbf4aeba70523ae5fabd3b46199c Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Tue, 4 Jun 2013 08:25:17 +0000 Subject: [PATCH] Fix ALIGNED misuse in asan_thread.cc (built on all platforms); also, add a comment to the ALIGNED macro describing the correct usage llvm-svn: 183214 --- compiler-rt/lib/asan/asan_thread.cc | 2 +- compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/asan/asan_thread.cc b/compiler-rt/lib/asan/asan_thread.cc index 5018b75f2947..1af3f74fa26f 100644 --- a/compiler-rt/lib/asan/asan_thread.cc +++ b/compiler-rt/lib/asan/asan_thread.cc @@ -40,7 +40,7 @@ void AsanThreadContext::OnFinished() { } // MIPS requires aligned address -static char thread_registry_placeholder[sizeof(ThreadRegistry)] ALIGNED(16); +static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)]; static ThreadRegistry *asan_thread_registry; static ThreadContextBase *GetAsanThreadContext(u32 tid) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index 9a7d374bf5ad..14d7fb37b671 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -132,6 +132,8 @@ using namespace __sanitizer; // NOLINT #else // _MSC_VER # define ALWAYS_INLINE inline __attribute__((always_inline)) # define ALIAS(x) __attribute__((alias(x))) +// Please only use the ALIGNED macro before the type. +// Using ALIGNED after the variable declaration is not portable! # define ALIGNED(x) __attribute__((aligned(x))) # define FORMAT(f, a) __attribute__((format(printf, f, a))) # define NOINLINE __attribute__((noinline))