Author: gallopruss-sie Date: 2026-09-28T10:49:41-07:00 New Revision: 26033a3b66ed79f44524065c6004a7a809616b49
URL: https://github.com/llvm/llvm-project/commit/26033a3b66ed79f44524065c6004a7a809616b49 DIFF: https://github.com/llvm/llvm-project/commit/26033a3b66ed79f44524065c6004a7a809616b49.diff LOG: [clang][test] Pass -resource-dir in riscv*-toolchain-extra.c tests (#226952) Fixes issue reported in https://github.com/llvm/llvm-project/pull/216996#issuecomment-5846218483 These tests check that, with no GCC installation, the driver finds the linker, crt0 and sysroot relative to its own bin/ directory. The compiler-rt paths come from the resource directory, which the tests did not specify, so they relied on the build's CLANG_RESOURCE_DIR placing it within the fake toolchain tree. With a relative CLANG_RESOURCE_DIR containing several "..", e.g. ../../../../lib/clang/24 as used by Gentoo, the resource directory resolves outside of the test tree. This previously passed only because the unnormalized path still contained "riscv64-nogcc/". Since 99988429d395 removed the dots from the path, the checks fail. Pass an explicit -resource-dir within the test tree so the tests don't depend on the build configuration. Claude Code helped with this. Added: Modified: clang/test/Driver/riscv32-toolchain-extra.c clang/test/Driver/riscv64-toolchain-extra.c Removed: ################################################################################ diff --git a/clang/test/Driver/riscv32-toolchain-extra.c b/clang/test/Driver/riscv32-toolchain-extra.c index d228a58d23d4e..b492f272870f7 100644 --- a/clang/test/Driver/riscv32-toolchain-extra.c +++ b/clang/test/Driver/riscv32-toolchain-extra.c @@ -28,7 +28,7 @@ // C-RV32-BAREMETAL-ILP32-NOGCC: "-internal-isystem" "{{.*}}/riscv32-nogcc/bin/../riscv32-unknown-elf/include" // C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-nogcc/bin/riscv32-unknown-elf-ld" // C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-nogcc/bin/../riscv32-unknown-elf/lib/crt0.o" -// C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-nogcc/{{.*}}/riscv32-unknown-unknown-elf/clang_rt.crtbegin.o" +// C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-unknown-unknown-elf/clang_rt.crtbegin.o" // C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-nogcc/bin/../riscv32-unknown-elf/lib" -// C-RV32-BAREMETAL-ILP32-NOGCC: "--start-group" "{{.*}}/riscv32-nogcc/{{.*}}/riscv32-unknown-unknown-elf/libclang_rt.builtins.a" "-lc" "-lgloss" "--end-group" -// C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-nogcc/{{.*}}/riscv32-unknown-unknown-elf/clang_rt.crtend.o" +// C-RV32-BAREMETAL-ILP32-NOGCC: "--start-group" "{{.*}}/riscv32-unknown-unknown-elf/libclang_rt.builtins.a" "-lc" "-lgloss" "--end-group" +// C-RV32-BAREMETAL-ILP32-NOGCC: "{{.*}}/riscv32-unknown-unknown-elf/clang_rt.crtend.o" diff --git a/clang/test/Driver/riscv64-toolchain-extra.c b/clang/test/Driver/riscv64-toolchain-extra.c index e1d3a10dd788d..15eb3dca07753 100644 --- a/clang/test/Driver/riscv64-toolchain-extra.c +++ b/clang/test/Driver/riscv64-toolchain-extra.c @@ -28,7 +28,7 @@ // C-RV64-BAREMETAL-LP64-NOGCC: "-internal-isystem" "{{.*}}/riscv64-nogcc/bin/../riscv64-unknown-elf/include" // C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-nogcc/bin/riscv64-unknown-elf-ld" // C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-nogcc/bin/../riscv64-unknown-elf/lib/crt0.o" -// C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-nogcc/{{.*}}/riscv64-unknown-unknown-elf/clang_rt.crtbegin.o" +// C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-unknown-unknown-elf/clang_rt.crtbegin.o" // C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-nogcc/bin/../riscv64-unknown-elf/lib" -// C-RV64-BAREMETAL-LP64-NOGCC: "--start-group" "{{.*}}/riscv64-nogcc/{{.*}}/riscv64-unknown-unknown-elf/libclang_rt.builtins.a" "-lc" "-lgloss" "--end-group" -// C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-nogcc/{{.*}}/riscv64-unknown-unknown-elf/clang_rt.crtend.o" +// C-RV64-BAREMETAL-LP64-NOGCC: "--start-group" "{{.*}}/riscv64-unknown-unknown-elf/libclang_rt.builtins.a" "-lc" "-lgloss" "--end-group" +// C-RV64-BAREMETAL-LP64-NOGCC: "{{.*}}/riscv64-unknown-unknown-elf/clang_rt.crtend.o" _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
