CLANG_DEFAULT_RTLIB had a typo, and libunwind isn't a valid option for it.
This keeps the practical behaviour from before, defaulting to none if using compiler-rt as rtlib.
Differential D98022
[clang] Fix typos in the default logic for CLANG_DEFAULT_UNWINDLIB mstorsjo on Mar 5 2021, 1:57 AM. Authored by
Details CLANG_DEFAULT_RTLIB had a typo, and libunwind isn't a valid option for it. This keeps the practical behaviour from before, defaulting to none if using compiler-rt as rtlib.
Diff Detail
Unit Tests Event TimelineComment Actions We use CLANG_DEFAULT_RTLIB=compiler-rt for our toolchain and it looks like after this change, two tests started failing: ******************** TEST 'Clang :: Driver/compiler-rt-unwind.c' FAILED ******************** /b/s/w/ir/x/w/llvm-project/clang/test/Driver/compiler-rt-unwind.c:9:15: error: RTLIB-GCC: expected string not found in input // RTLIB-GCC: "{{.*}}lgcc_s" ^ <stdin>:6:817: note: scanning from here "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/compiler-rt-unwind.c.tmp.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtbegin.o" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../.." "-L/b/s/w/ir/x/w/staging/llvm_build/bin/../lib" "-L/lib" "-L/usr/lib" "/b/s/w/ir/x/t/compiler-rt-unwind-1fb79b.o" "-lgcc" "-lc" "-lgcc" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crtn.o" ^ <stdin>:6:822: note: possible intended match here "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/compiler-rt-unwind.c.tmp.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtbegin.o" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../.." "-L/b/s/w/ir/x/w/staging/llvm_build/bin/../lib" "-L/lib" "-L/usr/lib" "/b/s/w/ir/x/t/compiler-rt-unwind-1fb79b.o" "-lgcc" "-lc" "-lgcc" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crtn.o" ^ Input file: <stdin> Check file: /b/s/w/ir/x/w/llvm-project/clang/test/Driver/compiler-rt-unwind.c -dump-input=help explains the following input dump. Input was: <<<<<< 1: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project 714644a36c3095e1dffeb2fb42da3876a5919d21) 2: Target: x86_64-unknown-linux 3: Thread model: posix 4: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 5: "/b/s/w/ir/x/w/staging/llvm_build/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-main-file-name" "compiler-rt-unwind.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/b/s/w/ir/x/w/staging/llvm_build/lib/clang/13.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/b/s/w/ir/x/w/staging/llvm_build/lib/clang/13.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir=/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/b/s/w/ir/x/t/compiler-rt-unwind-1fb79b.o" "-x" "c" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/compiler-rt-unwind.c" 6: "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/compiler-rt-unwind.c.tmp.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtbegin.o" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu" "-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" "-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../.." "-L/b/s/w/ir/x/w/staging/llvm_build/bin/../lib" "-L/lib" "-L/usr/lib" "/b/s/w/ir/x/t/compiler-rt-unwind-1fb79b.o" "-lgcc" "-lc" "-lgcc" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crtn.o" check:9'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found check:9'1 ? possible intended match >>>>>> ******************** TEST 'Clang :: Driver/linux-ld.c' FAILED ******************** /b/s/w/ir/x/w/llvm-project/clang/test/Driver/linux-ld.c:34:17: error: CHECK-LD-64: expected string not found in input // CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" ^ <stdin>:6:1011: note: scanning from here "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--sysroot=/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/linux-ld.c.tmp.o" "crt1.o" "crti.o" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib" "/b/s/w/ir/x/t/linux-ld-731974.o" "-lgcc" "-lc" "-lgcc" "crtend.o" "crtn.o" ^ <stdin>:6:1046: note: possible intended match here "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--sysroot=/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/linux-ld.c.tmp.o" "crt1.o" "crti.o" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib" "/b/s/w/ir/x/t/linux-ld-731974.o" "-lgcc" "-lc" "-lgcc" "crtend.o" "crtn.o" ^ Input file: <stdin> Check file: /b/s/w/ir/x/w/llvm-project/clang/test/Driver/linux-ld.c -dump-input=help explains the following input dump. Input was: <<<<<< 1: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project 714644a36c3095e1dffeb2fb42da3876a5919d21) 2: Target: x86_64-unknown-linux 3: Thread model: posix 4: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 5: "/b/s/w/ir/x/w/staging/llvm_build/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-main-file-name" "linux-ld.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/b/s/w/ir/x/w/staging/llvm_build/lib/clang/13.0.0" "-isysroot" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree" "-internal-isystem" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/local/include" "-internal-isystem" "/b/s/w/ir/x/w/staging/llvm_build/lib/clang/13.0.0/include" "-internal-externc-isystem" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/include" "-internal-externc-isystem" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/include" "-fdebug-compilation-dir=/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/b/s/w/ir/x/t/linux-ld-731974.o" "-x" "c" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/linux-ld.c" 6: "/b/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "--sysroot=/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree" "--hash-style=both" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/linux-ld.c.tmp.o" "crt1.o" "crti.o" "/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/lib" "-L/b/s/w/ir/x/w/llvm-project/clang/test/Driver/Inputs/basic_linux_tree/usr/lib" "/b/s/w/ir/x/t/linux-ld-731974.o" "-lgcc" "-lc" "-lgcc" "crtend.o" "crtn.o" check:34'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found check:34'1 ? possible intended match >>>>>> This is presumably because both of these tests assume that lgcc is present on the link line, but with CLANG_DEFAULT_RTLIB=compiler-rt that's not the case anymore. Comment Actions Right, yes, this is probably the correct culprit then. I attempted to keep the behaviour as it was, but I presume the more correct thing to do would be to have it set CLANG_DEFAULT_UNWINDLIB to the empty string, in this case, and that would match what was done before? Feel free to either revert or try to fix with such a change. Comment Actions Sure, but this change also was meant to be a NFC, which it wasn't... so either we make this case set the unwindlib to "", or just remove this case (as it never triggered before). As this logic has been in place for quite some time already, it's maybe a bit unnecessary to risk vague changes in behavior due to it. |