From 4b44e2039c78c51cd88ee1ef191c828eaef522b4 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Wed, 22 Apr 2026 14:53:35 -0700 Subject: [PATCH] [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. --- compiler-rt/test/fuzzer/lit.cfg.py | 2 +- compiler-rt/test/fuzzer/lit.site.cfg.py.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py index 1689f53d0b02..8cb731af2431 100644 --- a/compiler-rt/test/fuzzer/lit.cfg.py +++ b/compiler-rt/test/fuzzer/lit.cfg.py @@ -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++" diff --git a/compiler-rt/test/fuzzer/lit.site.cfg.py.in b/compiler-rt/test/fuzzer/lit.site.cfg.py.in index 3521b051b89d..9ccef3384135 100644 --- a/compiler-rt/test/fuzzer/lit.site.cfg.py.in +++ b/compiler-rt/test/fuzzer/lit.site.cfg.py.in @@ -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@"