[compiler-rt] 4b44e20 - [fuzzer] Set target_cflags instead of target_flags in lit config (#191510)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 14:53:40 PDT 2026


Author: Vitaly Buka
Date: 2026-04-22T14:53:35-07:00
New Revision: 4b44e2039c78c51cd88ee1ef191c828eaef522b4

URL: https://github.com/llvm/llvm-project/commit/4b44e2039c78c51cd88ee1ef191c828eaef522b4
DIFF: https://github.com/llvm/llvm-project/commit/4b44e2039c78c51cd88ee1ef191c828eaef522b4.diff

LOG: [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.

Added: 
    

Modified: 
    compiler-rt/test/fuzzer/lit.cfg.py
    compiler-rt/test/fuzzer/lit.site.cfg.py.in

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py
index 1689f53d0b021..8cb731af24314 100644
--- a/compiler-rt/test/fuzzer/lit.cfg.py
+++ b/compiler-rt/test/fuzzer/lit.cfg.py
@@ -70,7 +70,7 @@
 
 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 3521b051b89df..9ccef3384135e 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@"


        


More information about the llvm-commits mailing list