Skip to content

Commit

Permalink
clang/test: Remove platform-linker feature
Browse files Browse the repository at this point in the history
By explicitly requesting the system linker with `-fuse-ld=`, the
tests are able to CHECK for the system linker even with
CLANG_DEFAULT_LINKER=lld.

Alternative to D74704.

Differential Revision: https://reviews.llvm.org/D92291
  • Loading branch information
nico committed Dec 1, 2020
1 parent b5af578 commit 61da501
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
5 changes: 2 additions & 3 deletions clang/test/Driver/riscv32-toolchain-extra.c
Expand Up @@ -11,19 +11,18 @@
// The test below checks that the driver correctly finds the linker and
// runtime if and only if they exist.
//
// REQUIRES: platform-linker
// RUN: rm -rf %T/testroot-riscv32-baremetal-nogcc
// RUN: mkdir -p %T/testroot-riscv32-baremetal-nogcc/bin
// RUN: ln -s %clang %T/testroot-riscv32-baremetal-nogcc/bin/clang
// RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/bin/riscv32-unknown-elf-ld %T/testroot-riscv32-baremetal-nogcc/bin/riscv32-unknown-elf-ld
// RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf %T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf
// RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
// RUN: --gcc-toolchain=%T/testroot-riscv32-baremetal-nogcc/invalid \
// RUN: -target riscv32-unknown-elf --rtlib=platform 2>&1 \
// RUN: -target riscv32-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s

// RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
// RUN: -target riscv32-unknown-elf --rtlib=platform 2>&1 \
// RUN: -target riscv32-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s

// C-RV32-BAREMETAL-ILP32-NOGCC: "-internal-isystem" "{{.*}}Output/testroot-riscv32-baremetal-nogcc/bin/../riscv32-unknown-elf/include"
Expand Down
9 changes: 4 additions & 5 deletions clang/test/Driver/riscv32-toolchain.c
@@ -1,5 +1,4 @@
// A basic clang -cc1 command-line, and simple environment check.
// REQUIRES: platform-linker

// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
Expand All @@ -15,7 +14,7 @@
// In the below tests, --rtlib=platform is used so that the driver ignores
// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib

// RUN: %clang %s -### -no-canonical-prefixes \
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv32-unknown-elf --rtlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
Expand All @@ -30,7 +29,7 @@
// C-RV32-BAREMETAL-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clang %s -### -no-canonical-prefixes \
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv32-unknown-elf --rtlib=platform \
// RUN: --sysroot= \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
Expand All @@ -44,7 +43,7 @@
// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clangxx %s -### -no-canonical-prefixes \
// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
Expand All @@ -60,7 +59,7 @@
// CXX-RV32-BAREMETAL-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clangxx %s -### -no-canonical-prefixes \
// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
// RUN: --sysroot= \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
Expand Down
5 changes: 2 additions & 3 deletions clang/test/Driver/riscv64-toolchain-extra.c
Expand Up @@ -11,19 +11,18 @@
// The test below checks that the driver correctly finds the linker and
// runtime if and only if they exist.
//
// REQUIRES: platform-linker
// RUN: rm -rf %T/testroot-riscv64-baremetal-nogcc
// RUN: mkdir -p %T/testroot-riscv64-baremetal-nogcc/bin
// RUN: ln -s %clang %T/testroot-riscv64-baremetal-nogcc/bin/clang
// RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/bin/riscv64-unknown-elf-ld %T/testroot-riscv64-baremetal-nogcc/bin/riscv64-unknown-elf-ld
// RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf %T/testroot-riscv64-baremetal-nogcc/riscv64-unknown-elf
// RUN: %T/testroot-riscv64-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
// RUN: --gcc-toolchain=%T/testroot-riscv64-baremetal-nogcc/invalid \
// RUN: -target riscv64-unknown-elf --rtlib=platform 2>&1 \
// RUN: -target riscv64-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64-NOGCC %s

// RUN: %T/testroot-riscv64-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
// RUN: -target riscv64-unknown-elf --rtlib=platform 2>&1 \
// RUN: -target riscv64-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64-NOGCC %s

// C-RV64-BAREMETAL-LP64-NOGCC: "-internal-isystem" "{{.*}}Output/testroot-riscv64-baremetal-nogcc/bin/../riscv64-unknown-elf/include"
Expand Down
11 changes: 5 additions & 6 deletions clang/test/Driver/riscv64-toolchain.c
@@ -1,5 +1,4 @@
// A basic clang -cc1 command-line, and simple environment check.
// REQUIRES: platform-linker

// RUN: %clang %s -### -no-canonical-prefixes -target riscv64 \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \
Expand All @@ -15,7 +14,7 @@
// In the below tests, --rtlib=platform is used so that the driver ignores
// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib

// RUN: %clang %s -### -no-canonical-prefixes \
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv64-unknown-elf --rtlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree \
// RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \
Expand All @@ -30,7 +29,7 @@
// C-RV64-BAREMETAL-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clang %s -### -no-canonical-prefixes \
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv64-unknown-elf --rtlib=platform \
// RUN: --sysroot= \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \
Expand All @@ -44,7 +43,7 @@
// C-RV64-BAREMETAL-NOSYSROOT-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clangxx %s -### -no-canonical-prefixes \
// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv64-unknown-elf -stdlib=libstdc++ --rtlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree \
// RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \
Expand All @@ -60,7 +59,7 @@
// CXX-RV64-BAREMETAL-LP64: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// CXX-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clangxx %s -### -no-canonical-prefixes \
// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
// RUN: -target riscv64-unknown-elf -stdlib=libstdc++ --rtlib=platform \
// RUN: --sysroot= \
// RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \
Expand All @@ -75,7 +74,7 @@
// CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc"
// CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o"

// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld -fuse-ld= \
// RUN: -target riscv64-unknown-linux-gnu --rtlib=platform -mabi=lp64 \
// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
Expand Down
3 changes: 0 additions & 3 deletions clang/test/lit.site.cfg.py.in
Expand Up @@ -47,9 +47,6 @@ except KeyError:
import lit.llvm
lit.llvm.initialize(lit_config, config)

if not "@CLANG_DEFAULT_LINKER@":
config.available_features.add('platform-linker')

# Let the main config do the real work.
lit_config.load_config(
config, os.path.join(config.clang_src_dir, "test/lit.cfg.py"))
1 change: 0 additions & 1 deletion llvm/utils/gn/secondary/clang/test/BUILD.gn
Expand Up @@ -46,7 +46,6 @@ write_lit_config("lit_site_cfg") {
"LLVM_WITH_Z3=", # Must be empty, not 0.
"CLANG_BUILD_EXAMPLES=0",
"CLANG_DEFAULT_CXX_STDLIB=", # Empty string means "default value" here.
"CLANG_DEFAULT_LINKER=",
"CLANG_TOOLS_DIR=" + rebase_path("$root_out_dir/bin", dir),
"CLANG_VENDOR_UTI=org.llvm.clang",

Expand Down

0 comments on commit 61da501

Please sign in to comment.