Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - Fix cmake BOOL misspellings - Set cmake policy for CMP0075 to NEW This is a WIP as there are some issues: 1) If I do a check-all after compiling master with no changes there are 8 FAILED tests. $ grep 'FAILED ' log-master.txt ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/aligned_alloc-alignment.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/pvalloc-overflow.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Posix/posix_memalign-alignment.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: Linux/double_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race2.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcmp_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcpy_race.cc' FAILED ******************** 2) With this change I get 9 FAILED tests, the first one is "new": $ grep 'FAILED ' ../log-compiler-rt-fix-cmake-warnings-2.txt ******************** TEST 'Clang :: Driver/fsanitize-coverage.c' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/aligned_alloc-alignment.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/pvalloc-overflow.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Posix/posix_memalign-alignment.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: Linux/double_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race2.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcmp_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcpy_race.cc' FAILED ******************** 3) And if I build with COMPILER_RT_BAREMETAL_BUILD=ON and COMPILER_RT_HWASAN_WITH_INTERCEPTORS=ON I now have 10 FAILED tests. The first one is "new": $ grep 'FAILED ' log-compiler-rt-fix-cmake-warnings-BAREMETAL_BUILD-ON.txt ******************** TEST 'Builtins-x86_64-linux :: enable_execute_stack_test.c' FAILED ******************** ******************** TEST 'Clang :: Driver/fsanitize-coverage.c' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/aligned_alloc-alignment.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/pvalloc-overflow.cc' FAILED ******************** ******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Posix/posix_memalign-alignment.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: Linux/double_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: inlined_memcpy_race2.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcmp_race.cc' FAILED ******************** ******************** TEST 'ThreadSanitizer-x86_64 :: memcpy_race.cc' FAILED ******************** 4) If I build with COMPILER_RT_HWASAN_WITH_INTERCEPTORS=OFF and COMPILER_RT_BAREMETAL_BUILD=OFF then there is a compile error: [1/1477] Building CXX object projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan.x86_64.dir/hwasan_linux.cpp.o FAILED: projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan.x86_64.dir/hwasan_linux.cpp.o /usr/bin/c++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/hwasan -I/home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan -I/usr/include/libxml2 -Iinclude -I/home/wink/prgs/llvm/llvm-project/llvm/include -I/home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O3 -DNDEBUG -m64 -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 -fPIC -ffreestanding -MD -MT projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan.x86_64.dir/hwasan_linux.cpp.o -MF projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan.x86_64.dir/hwasan_linux.cpp.o.d -o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan.x86_64.dir/hwasan_linux.cpp.o -c /home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp /home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp: In function ‘__sanitizer::uptr* __hwasan::GetCurrentThreadLongPtr()’: /home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp:285:11: error: ‘__hwasan_tls’ was not declared in this scope return &__hwasan_tls; ^~~~~~~~~~~~ /home/wink/prgs/llvm/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp:285:11: note: suggested alternative: ‘__hwasan_init’ return &__hwasan_tls; ^~~~~~~~~~~~ __hwasan_init ninja: build stopped: subcommand failed. The above problem occurs because __hwasan_tls is undefined as this code is NOT compiled: 41 #if HWASAN_WITH_INTERCEPTORS && !SANITIZER_ANDROID 42 SANITIZER_INTERFACE_ATTRIBUTE 43 THREADLOCAL uptr __hwasan_tls; 44 #endif But __hwasan_tls is used on line 285, thus the error: 279 #if SANITIZER_ANDROID 280 uptr *GetCurrentThreadLongPtr() { 281 return (uptr *)get_android_tls_ptr(); 282 } 283 #else 284 uptr *GetCurrentThreadLongPtr() { 285 return &__hwasan_tls; 286 } 287 #endif I looked at change 090f0f9 I see that before 090f0f9 when HWASAN_WITH_INTERCEPTORS is false SANTIZER_ANDROID was required to be true. Below is a snippet from compiler-rt/lib/hwasan/hwasan_linux.cc at 20c4999, the change before 090f0...: 228 #if HWASAN_WITH_INTERCEPTORS 229 static pthread_key_t tsd_key; 230 static bool tsd_key_inited = false; 231 ... 248 249 Thread *GetCurrentThread() { 250 return (Thread *)pthread_getspecific(tsd_key); 251 } ... 260 #elif SANITIZER_ANDROID 261 void HwasanTSDInit() {} 262 Thread *GetCurrentThread() { 263 return (Thread*)*get_android_tls_ptr(); 264 } 265 266 void SetCurrentThread(Thread *t) { 267 *get_android_tls_ptr() = (uptr)t; 268 } 269 #else 270 #error unsupported configuration !HWASAN_WITH_INTERCEPTORS && !SANITIZER_ANDROID 271 #endif So maybe the fix is to reintroduce a "unsupported configuration" error. The build with: $ cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" -DCMAKE_INSTALL_PREFIX=$~/local -DCMAKE_BUILD_TYPE=Release $ ninja -v $ ninja -v check-all My system is Arch Linux: $ uname -a Linux wink-desktop 5.0.8-arch1-1-ARCH llvm#1 SMP PREEMPT Wed Apr 17 14:56:15 UTC 2019 x86_64 GNU/Linux Reviewers: daemon, clm, pcc Subscribers: dberris, mgorny, mehdi_amini, dexonsmith, jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61203
- Loading branch information