Skip to content

Commit 2e65a42

Browse files
committed
[Driver][test] Ensure --target= for -flto commands
Otherwise if the default target triple has `HasNativeLLVMSupport() == false`, the %clang command will exit with code 1 due to err_drv_no_linker_llvm_support. The issue is exposed by D156363.
1 parent d8f9663 commit 2e65a42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/test/Driver/clang_f_opts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
// RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
115115
// RUN: %clang -### -S -fprofile-remapping-file=foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s
116116
// RUN: %clang -### -S -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR %s
117-
// RUN: %clang -### -flto -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR-LTO %s
117+
// RUN: %clang -### --target=x86_64-linux-gnu -flto -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR-LTO %s
118118
// CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
119119
// CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm"
120120
// CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|\\\\}}{{.*}}"

clang/test/Driver/lto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
// llvm-bc and llvm-ll outputs need to match regular suffixes
1818
// (unfortunately).
19-
// RUN: %clang %s -flto -save-temps -### 2> %t
19+
// RUN: %clang --target=x86_64-linux-gnu %s -flto -save-temps -### 2> %t
2020
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-SUFFIXES < %t %s
2121
//
2222
// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.i" "-x" "c" "{{.*}}lto.c"
2323
// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.bc" {{.*}}"{{.*}}lto.i"
2424
// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.o" {{.*}}"{{.*}}lto.bc"
2525
// CHECK-COMPILELINK-SUFFIXES: "{{.*}}a.{{(out|exe)}}" {{.*}}"{{.*}}lto.o"
2626

27-
// RUN: %clang %s -flto -S -### 2> %t
27+
// RUN: %clang --target=x86_64-linux-gnu %s -flto -S -### 2> %t
2828
// RUN: FileCheck -check-prefix=CHECK-COMPILE-SUFFIXES < %t %s
2929
//
3030
// CHECK-COMPILE-SUFFIXES: "-o" "{{.*}}lto.s" "-x" "c" "{{.*}}lto.c"

0 commit comments

Comments
 (0)