kristina created this revision. kristina added reviewers: sammccall, lebedev.ri, sthibaul. Herald added a project: clang.
Driver test `cross-linux.c` fails when CLANG_DEFAULT_RTLIB is "compiler-rt" as the it expects a GCC-style `"crtbegin.o"` after `"crti.o"` but instead receives something akin to this in the frontend invocation: "crt1.o" "crti.o" "/o/b/llvm-test/v10.0.4010/bin/../lib/clang/10.0.4010/lib/linux/clang_rt.crtbegin-x86_64.o" In `lib/Driver/ToolChain.cpp` it's implied that using `--rtlib=platform` is acceptable in tests to override the configuration-time default. // Only use "platform" in tests to override CLANG_DEFAULT_RTLIB // ... else if (LibName == "platform") return GetDefaultRuntimeLibType(); This patch adds said override to `cross-linux.c` tests so the expected result is produced regardless of the compile-time default rtlib, as having tests fail due to that is fairly confusing. After applying the patch, the test passes regardless of the CLANG_DEFAULT_RTLIB setting. nb. Originally ran across this issue in D69758 <https://reviews.llvm.org/D69758>. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D72236 Files: clang/test/Driver/cross-linux.c Index: clang/test/Driver/cross-linux.c =================================================================== --- clang/test/Driver/cross-linux.c +++ clang/test/Driver/cross-linux.c @@ -52,6 +52,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_32bit_linux_tree/usr \ // RUN: --target=x86_64-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI32-X86-64 %s // CHECK-MULTI32-X86-64: "-cc1" "-triple" "x86_64-unknown-linux" @@ -70,6 +71,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: --target=i386-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI64-I386 %s // CHECK-MULTI64-I386: "-cc1" "-triple" "i386-unknown-linux" @@ -88,6 +90,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: --target=x86_64-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI64-X86-64 %s // CHECK-MULTI64-X86-64: "-cc1" "-triple" "x86_64-unknown-linux"
Index: clang/test/Driver/cross-linux.c =================================================================== --- clang/test/Driver/cross-linux.c +++ clang/test/Driver/cross-linux.c @@ -52,6 +52,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_32bit_linux_tree/usr \ // RUN: --target=x86_64-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI32-X86-64 %s // CHECK-MULTI32-X86-64: "-cc1" "-triple" "x86_64-unknown-linux" @@ -70,6 +71,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: --target=i386-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI64-I386 %s // CHECK-MULTI64-I386: "-cc1" "-triple" "i386-unknown-linux" @@ -88,6 +90,7 @@ // RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ // RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: --target=x86_64-unknown-linux \ +// RUN: --rtlib=platform \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-MULTI64-X86-64 %s // CHECK-MULTI64-X86-64: "-cc1" "-triple" "x86_64-unknown-linux"
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits