[compiler-rt] 474145c - [CMake] Build lib/gwp_asan/tests with -std=c++17
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 17:51:22 PDT 2022
Author: Fangrui Song
Date: 2022-08-08T17:51:17-07:00
New Revision: 474145c0b2420cb316bb8a9dcc031d613679d496
URL: https://github.com/llvm/llvm-project/commit/474145c0b2420cb316bb8a9dcc031d613679d496
DIFF: https://github.com/llvm/llvm-project/commit/474145c0b2420cb316bb8a9dcc031d613679d496.diff
LOG: [CMake] Build lib/gwp_asan/tests with -std=c++17
With the recent llvm-project C++17 switch (D130689), gwp_asan/tests may fail to
link with some versions of GCC (https://github.com/llvm/llvm-project/issues/56994):
> backtrace.cpp:(.text+0xca6): undefined reference to `gwp_asan::AllocationMetadata::kMaxTraceLengthToCollect'
I cannot reproduce this issue by myself, but notice that currently
lib/gwp_asan/*.cpp get -std=c++17 while lib/gwp_asan/tests/*.cpp don't
(therefore may use -std=g++14 default from Clang and older GCC). Using -std=c++17
for lib/gwp_asan/tests will ensure that backtrace.cpp uses inline variable and will assuredly avoid the
possible GCC issue.
In the long-term, we should add -std=c++17 to a central place like generate_compiler_rt_tests.
Reviewed By: dyung
Differential Revision: https://reviews.llvm.org/D131440
Added:
Modified:
compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt b/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
index bff1751e85f6d..ef7ea28b39837 100644
--- a/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
@@ -4,6 +4,7 @@ set(GWP_ASAN_UNITTEST_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
${SANITIZER_TEST_CXX_CFLAGS}
+ -std=c++17
-I${COMPILER_RT_SOURCE_DIR}/lib/
-O2
-g
More information about the llvm-commits
mailing list