[compiler-rt] 07317bb - [compiler-rt] Build libfuzzer sources with the chosen C++ compiler
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 19:18:07 PST 2024
Author: Alex Richardson
Date: 2024-03-01T19:11:39-08:00
New Revision: 07317bbc66d1f2d7663af3c9f04d0f6c0487ac03
URL: https://github.com/llvm/llvm-project/commit/07317bbc66d1f2d7663af3c9f04d0f6c0487ac03
DIFF: https://github.com/llvm/llvm-project/commit/07317bbc66d1f2d7663af3c9f04d0f6c0487ac03.diff
LOG: [compiler-rt] Build libfuzzer sources with the chosen C++ compiler
I was getting build failures due to missing <cstddef> when building the
libfuzzer tests. It turns out that the custom command was using
COMPILER_RT_TEST_COMPILER when building the source file rather than
the COMPILER_RT_TEST_CXX_COMPILER.
Pull Request: https://github.com/llvm/llvm-project/pull/83090
Added:
Modified:
compiler-rt/cmake/Modules/CompilerRTCompile.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
index 64e7acb9afd833..2bf115973a49b3 100644
--- a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
@@ -70,9 +70,14 @@ function(clang_compile object_file source)
if (TARGET CompilerRTUnitTestCheckCxx)
list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
endif()
+ string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
+ if (is_cxx)
+ set(compiler ${COMPILER_RT_TEST_COMPILER})
+ else()
+ set(compiler ${COMPILER_RT_TEST_CXX_COMPILER})
+ endif()
if(COMPILER_RT_STANDALONE_BUILD)
# Only add global flags in standalone build.
- string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
if(is_cxx)
string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")
else()
@@ -102,7 +107,7 @@ function(clang_compile object_file source)
add_custom_command(
OUTPUT ${object_file}
- COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c
+ COMMAND ${compiler} ${compile_flags} -c
-o "${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
More information about the llvm-commits
mailing list