[fuzzer] Set target_cflags instead of target_flags in lit config (#191510)
This PR fixes warning "Compiler lib dir != compiler-rt lib dir" There is a check in compiler-rt/test/lit.common.cfg.py which detects runtime dir using target_cflags. If we set target_flags only, the test will complain as below: The persistent from #111498, but I don't see anything wrong. ``` cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -DLLVM_CCACHE_BUILD=ON -DLLVM_ENABLE_ASSERTIONS=OFF '-DLLVM_ENABLE_PROJECTS='\''clang;lld'\''' '-DLLVM_ENABLE_RUNTIMES='\''compiler-rt;libunwind;libcxx;libcxxabi'\''' -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../../llvm-project/llvm ninja check-compiler-rt ``` ``` -- Installing: runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/lib/libc++.modules.json [3235/3236] Running compiler_rt regression tests llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:244: warning: Compiler lib dir != compiler-rt lib dir Compiler libdir: "lib/clang/23/lib/x86_64-unknown-linux-gnu" compiler-rt libdir: "lib/clang/23/lib/i386-unknown-linux-gnu" llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:255: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead. llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:266: note: Testing using libraries in "./lib/../lib/clang/23/lib/i386-unknown-linux-gnu" llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:244: warning: Compiler lib dir != compiler-rt lib dir Compiler libdir: "lib/clang/23/lib/x86_64-unknown-linux-gnu" compiler-rt libdir: "lib/clang/23/lib/i386-unknown-linux-gnu" llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:255: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead. llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:266: note: Testing using libraries in "./lib/../lib/clang/23/lib/i386-unknown-linux-gnu" llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:244: warning: Compiler lib dir != compiler-rt lib dir Compiler libdir: "lib/clang/23/lib/x86_64-unknown-linux-gnu" compiler-rt libdir: "lib/clang/23/lib/i386-unknown-linux-gnu" llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:255: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead. llvm-lit: llvm-project/compiler-rt/test/lit.common.cfg.py:266: note: Testing using libraries in "./lib/../lib/clang/23/lib/i386-unknown-linux-gnu" ``` For libfuzzer there should be no difference, as it already applies target_cflags.
This commit is contained in:
@@ -70,7 +70,7 @@ config.substitutions.append(("%python", '"%s"' % (sys.executable)))
|
||||
|
||||
def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
|
||||
compiler_cmd = config.clang
|
||||
extra_cmd = config.target_flags
|
||||
extra_cmd = ""
|
||||
|
||||
if is_cpp:
|
||||
std_cmd = "--driver-mode=g++"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@LIT_SITE_CFG_IN_HEADER@
|
||||
|
||||
config.cpp_compiler = "@LIBFUZZER_TEST_COMPILER@"
|
||||
config.target_flags = "@LIBFUZZER_TEST_FLAGS@"
|
||||
config.target_cflags = "@LIBFUZZER_TEST_FLAGS@"
|
||||
config.c_compiler = "@LIBFUZZER_TEST_COMPILER@"
|
||||
config.stdlib = "@LIBFUZZER_TEST_STDLIB@"
|
||||
config.apple_platform = "@LIBFUZZER_TEST_APPLE_PLATFORM@"
|
||||
|
||||
Reference in New Issue
Block a user