[PATCH] D44261: [sanitizer] Align & pad the allocator structures to the cacheline size

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 11:47:10 PST 2018


thakis added inline comments.


================
Comment at: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h:269
 
-  struct SizeClassInfo {
+  struct ALIGNED(kCacheLineSize) SizeClassInfo {
     SpinMutex mutex;
----------------
This doesn't build on our bots: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.clang%2FToTLinux%2F1811%2F%2B%2Frecipes%2Fsteps%2Fgclient_runhooks%2F0%2Fstdout

FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_allocator.cc.o 
/b/c/b/ToTLinux/src/third_party/llvm-build-tools/gcc485precise/bin/g++   -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/.. -DLLVM_FORCE_HEAD_REVISION -Wall -std=c++11 -Wno-unused-parameter -O3 -DNDEBUG    -DLLVM_FORCE_HEAD_REVISION -Wall -std=c++11 -Wno-unused-parameter -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -MMD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_allocator.cc.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_allocator.cc.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_allocator.cc.o -c /b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
In file included from /b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h:76:0,
                 from /b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:15:
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h: In instantiation of ‘struct __sanitizer::SizeClassAllocator32<__sanitizer::AP32>::SizeClassInfo’:
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h:274:3:   required from ‘class __sanitizer::SizeClassAllocator32<__sanitizer::AP32>’
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h:193:20:   required from ‘class __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator32<__sanitizer::AP32>, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >, __sanitizer::LargeMmapAllocator<__sanitizer::NoOpMapUnmapCallback, __sanitizer::LargeMmapAllocatorPtrArrayStatic> >’
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:84:76:   required from here
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant
   struct ALIGNED(kCacheLineSize) SizeClassInfo {
                                  ^
In file included from /b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h:17:0,
                 from /b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:15:
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h: In instantiation of ‘class __sanitizer::SizeClassAllocator32<__sanitizer::AP32>’:
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h:193:20:   required from ‘class __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator32<__sanitizer::AP32>, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >, __sanitizer::LargeMmapAllocator<__sanitizer::NoOpMapUnmapCallback, __sanitizer::LargeMmapAllocatorPtrArrayStatic> >’
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:84:76:   required from here
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:330:72: error: size of array is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:324:30: note: in expansion of macro ‘IMPL_COMPILER_ASSERT’
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                              ^
/b/c/b/ToTLinux/src/third_party/llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h:274:3: note: in expansion of macro ‘COMPILER_CHECK’
   COMPILER_CHECK(sizeof(SizeClassInfo) % kCacheLineSize == 0);


Repository:
  rL LLVM

https://reviews.llvm.org/D44261





More information about the llvm-commits mailing list