Skip to content

Commit e71eed0

Browse files
authored
[Driver] Update unbundling of offload libraries to use archive type (#2883)
When unbundling libraries, use the 'a' type for the unbundler which will create an archive of extracted binaries. This moves away from the 'aoo' type which was used when performing the now defunct partial link step.
1 parent 4db04af commit e71eed0

File tree

9 files changed

+48
-66
lines changed

9 files changed

+48
-66
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6106,13 +6106,11 @@ InputInfo Driver::BuildJobsForActionNoCache(
61066106
// enabled is not used
61076107
if (UI.DependentOffloadKind == Action::OFK_Host && IsFPGAObjLink)
61086108
continue;
6109-
std::string TmpFileName =
6110-
C.getDriver().GetTemporaryPath(llvm::sys::path::stem(BaseInput),
6111-
"txt");
6109+
std::string TmpFileName = C.getDriver().GetTemporaryPath(
6110+
llvm::sys::path::stem(BaseInput), "a");
61126111
const char *TmpFile =
6113-
C.addTempFile(C.getArgs().MakeArgString(TmpFileName),
6114-
types::TY_Tempfilelist);
6115-
CurI = InputInfo(types::TY_Tempfilelist, TmpFile, TmpFile);
6112+
C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
6113+
CurI = InputInfo(types::TY_Archive, TmpFile, TmpFile);
61166114
} else if (types::isFPGA(JA->getType())) {
61176115
std::string Ext(types::getTypeTempSuffix(JA->getType()));
61186116
types::ID TI = types::TY_Object;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7679,8 +7679,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
76797679
else
76807680
TypeArg = "aoo";
76817681
}
7682-
if (InputType == types::TY_FPGA_AOCO || IsFPGADepLibUnbundle ||
7683-
types::isArchive(InputType))
7682+
if (InputType == types::TY_FPGA_AOCO || IsFPGADepLibUnbundle)
76847683
TypeArg = "aoo";
76857684
if (IsFPGADepUnbundle)
76867685
TypeArg = "o";

clang/test/Driver/openmp-offload.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,12 +663,12 @@
663663
/// test behaviors of -foffload-static-lib=<lib>
664664
// RUN: echo "void foo(void) {}" > %t1.cpp
665665
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu %t1.cpp -c -o %t1_bundle.o
666-
// RUN: llvm-ar cr %t.a %t1_bundle.o
666+
// RUN: llvm-ar cr %t-fatlib.a %t1_bundle.o
667667
// RUN: touch %t.o
668-
// RUN: %clang -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu -foffload-static-lib=%t.a -### %t.o 2>&1 \
668+
// RUN: %clang -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu -foffload-static-lib=%t-fatlib.a -### %t.o 2>&1 \
669669
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB
670-
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo"
671-
// FOFFLOAD_STATIC_LIB: ld{{.*}} "@{{.*}}"
670+
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a"
671+
// FOFFLOAD_STATIC_LIB: ld{{.*}} "{{.+}}-fatlib.a"
672672

673673
// TODO: SYCL specific fail - analyze and enable
674674
// XFAIL: windows-msvc

clang/test/Driver/sycl-intelfpga-aoco-win.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
// RUN: | FileCheck -check-prefix=CHK-FPGA-AOCO %s
4242
// RUN: %clang_cl -fsycl -fno-sycl-device-lib=all -fintelfpga %t_aoco.a -### %s 2>&1 \
4343
// RUN: | FileCheck -check-prefix=CHK-FPGA-AOCO %s
44-
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-outputs={{.*}}" "-unbundle"
45-
// CHK-FPGA-AOCO: llvm-link{{.*}} "@{{.*}}" "-o" "[[LINKEDBC:.+\.bc]]"
44+
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=a" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-outputs=[[OUTLIB:.+\.a]]" "-unbundle"
45+
// CHK-FPGA-AOCO: llvm-link{{.*}} "[[OUTLIB]]" "-o" "[[LINKEDBC:.+\.bc]]"
4646
// CHK-FPGA-AOCO: sycl-post-link{{.*}} "-ir-output-only" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
4747
// CHK-FPGA-AOCO: llvm-spirv{{.*}} "-o" "[[TARGSPV:.+\.spv]]" {{.*}} "[[PLINKEDBC]]"
4848
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB]]" "-outputs=[[AOCOLIST:.+\.txt]]" "-unbundle"

clang/test/Driver/sycl-intelfpga-aoco.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-WIN %s
7878
// RUN: %clang_cl -fsycl -fno-sycl-device-lib=all -fintelfpga %t_aoco_cl.a -### %s 2>&1 \
7979
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-WIN %s
80-
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-outputs={{.*}}" "-unbundle"
81-
// CHK-FPGA-AOCO: llvm-link{{.*}} "@{{.*}}" "-o" "[[LINKEDBC:.+\.bc]]"
80+
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=a" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-outputs=[[OUTLIB:.+\.a]]" "-unbundle"
81+
// CHK-FPGA-AOCO: llvm-link{{.*}} "[[OUTLIB]]" "-o" "[[LINKEDBC:.+\.bc]]"
8282
// CHK-FPGA-AOCO: sycl-post-link{{.*}} "-ir-output-only" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
8383
// CHK-FPGA-AOCO: llvm-spirv{{.*}} "-o" "[[TARGSPV:.+\.spv]]" {{.*}} "[[PLINKEDBC]]"
8484
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB]]" "-outputs=[[AOCOLIST:.+\.txt]]" "-unbundle"

clang/test/Driver/sycl-offload-static-lib-2.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_lib.lo -### %t_obj.o 2>&1 \
2323
// RUN: | FileCheck %s -check-prefix=STATIC_LIB
2424
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs=[[INPUTO:.+\.o]]" "-outputs=[[HOSTOBJ:.+\.o]],{{.+\.o}}"
25-
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo" {{.*}} "-inputs={{.*}}" "-outputs=[[LISTFILE:.+\.txt]]"
26-
// STATIC_LIB: llvm-link{{.*}} "@[[LISTFILE]]"
25+
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs={{.*}}" "-outputs=[[OUTFILE:.+\.a]]"
26+
// STATIC_LIB: llvm-link{{.*}} "[[OUTFILE]]"
2727
// STATIC_LIB: ld{{.*}} "{{.*}}_lib.{{(a|lo)}}" "[[HOSTOBJ]]"
2828

2929
/// ###########################################################################
@@ -38,8 +38,8 @@
3838
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-1.o"
3939
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-2.o"
4040
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-3.o"
41-
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=aoo"
42-
// STATIC_LIB_MULTI_O: llvm-link{{.*}} "@{{.*}}"
41+
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTFILE:.+\.a]]"
42+
// STATIC_LIB_MULTI_O: llvm-link{{.*}} "[[OUTFILE]]"
4343

4444
/// ###########################################################################
4545

@@ -74,8 +74,8 @@
7474
// RUN: touch %t_lib.a
7575
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t_lib.a -o output_name -lOpenCL -### %s 2>&1 \
7676
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2
77-
// STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=aoo"
78-
// STATIC_LIB_SRC2: llvm-link{{.*}} "@{{.*}}"
77+
// STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=a"
78+
// STATIC_LIB_SRC2: llvm-link{{.*}} "{{.*}}"
7979
// STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
8080
// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "[[HOSTOBJ]]"
8181

@@ -84,8 +84,8 @@
8484
// RUN: touch %t_lib.a
8585
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t_lib.a -o output_name -lstdc++ -z relro -### %s 2>&1 \
8686
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC3
87-
// STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=aoo"
88-
// STATIC_LIB_SRC3: llvm-link{{.*}} "@{{.*}}"
87+
// STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=a"
88+
// STATIC_LIB_SRC3: llvm-link{{.*}} "{{.*}}"
8989
// STATIC_LIB_SRC3: ld{{(.exe)?}}" {{.*}} "-o" "output_name" {{.*}} "-lstdc++" "-z" "relro"
9090

9191
/// ###########################################################################
@@ -101,9 +101,9 @@
101101
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_obj.o -Wl,@%/t_arg.arg -### 2>&1 \
102102
// RUN: | FileCheck %s -check-prefix=WHOLE_STATIC_LIB
103103
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" {{.*}}
104-
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo" {{.*}} "-inputs=[[INPUTA:.+\.a]]"
105-
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo" {{.*}} "-inputs=[[INPUTB:.+\.a]]"
106-
// WHOLE_STATIC_LIB: llvm-link{{.*}} "@{{.*}}"
104+
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTA:.+\.a]]" "-outputs=[[OUTPUTA:.+\.a]]"
105+
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTB:.+\.a]]" "-outputs=[[OUTPUTB:.+\.a]]"
106+
// WHOLE_STATIC_LIB: llvm-link{{.*}} "[[OUTPUTA]]" "[[OUTPUTB]]"
107107
// WHOLE_STATIC_LIB: llvm-spirv{{.*}}
108108
// WHOLE_STATIC_LIB: clang-offload-wrapper{{.*}}
109109
// WHOLE_STATIC_LIB: llc{{.*}}
@@ -124,8 +124,8 @@
124124
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC
125125
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-device-lib=all -L/dummy/dir %t_lib.lo -### 2>&1 \
126126
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC
127-
// STATIC_LIB_NOSRC: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}_lib.{{(a|lo)}}" "-outputs=[[DEVICELIST:.+\.txt]]" "-unbundle"
128-
// STATIC_LIB_NOSRC: llvm-link{{.*}} "@[[DEVICELIST]]" "-o" "[[BCFILE:.+\.bc]]"
127+
// STATIC_LIB_NOSRC: clang-offload-bundler{{.*}} "-type=a" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}_lib.{{(a|lo)}}" "-outputs=[[DEVICELIB:.+\.a]]" "-unbundle"
128+
// STATIC_LIB_NOSRC: llvm-link{{.*}} "[[DEVICELIB]]" "-o" "[[BCFILE:.+\.bc]]"
129129
// STATIC_LIB_NOSRC: sycl-post-link{{.*}} "-o" "[[TABLE:.+\.table]]" "[[BCFILE]]"
130130
// STATIC_LIB_NOSRC: file-table-tform{{.*}} "-o" "[[LIST:.+\.txt]]" "[[TABLE]]"
131131
// STATIC_LIB_NOSRC: llvm-foreach{{.*}}llvm-spirv{{.*}} "-o" "[[SPVLIST:.+\.txt]]"{{.*}} "[[LIST]]"

clang/test/Driver/sycl-offload-static-lib.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
// RUN: touch %t.o
1919
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir -foffload-static-lib=%t.a -### %t.o 2>&1 \
2020
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB
21-
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo"
22-
// FOFFLOAD_STATIC_LIB: llvm-link{{.*}} "@{{.*}}"
21+
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
22+
// FOFFLOAD_STATIC_LIB: llvm-link{{.*}} "[[OUTLIB]]"
2323

2424
/// Use of -foffload-static-lib and -foffload-whole-static-lib are deprecated
2525
// RUN: touch dummy.a
@@ -41,8 +41,8 @@
4141
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-1.o"
4242
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-2.o"
4343
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-3.o"
44-
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=aoo"
45-
// FOFFLOAD_STATIC_LIB_MULTI_O: llvm-link{{.*}} "@{{.*}}"
44+
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
45+
// FOFFLOAD_STATIC_LIB_MULTI_O: llvm-link{{.*}} "[[OUTLIB]]"
4646

4747
/// ###########################################################################
4848

@@ -78,8 +78,8 @@
7878
// RUN: touch %t.a
7979
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib=%t.a -### %s 2>&1 \
8080
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC2
81-
// FOFFLOAD_STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=aoo"
82-
// FOFFLOAD_STATIC_LIB_SRC2: llvm-link{{.*}} "@{{.*}}"
81+
// FOFFLOAD_STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
82+
// FOFFLOAD_STATIC_LIB_SRC2: llvm-link{{.*}} "[[OUTLIB]]"
8383
// FOFFLOAD_STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
8484
// FOFFLOAD_STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "[[HOSTOBJ]]"
8585

@@ -88,17 +88,17 @@
8888
// RUN: touch %t.a
8989
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib=%t.a -o output_name -lOpenCL -### %s 2>&1 \
9090
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC3
91-
// FOFFLOAD_STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=aoo"
92-
// FOFFLOAD_STATIC_LIB_SRC3: llvm-link{{.*}} "@{{.*}}"
91+
// FOFFLOAD_STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
92+
// FOFFLOAD_STATIC_LIB_SRC3: llvm-link{{.*}} "[[OUTLIB]]"
9393
// FOFFLOAD_STATIC_LIB_SRC3: ld{{(.exe)?}}" {{.*}} "-o" "output_name" {{.*}} "-lOpenCL"
9494

9595
/// ###########################################################################
9696

9797
// RUN: touch %t.a
9898
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib=%t.a -o output_name -lstdc++ -z relro -### %s 2>&1 \
9999
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC4
100-
// FOFFLOAD_STATIC_LIB_SRC4: clang-offload-bundler{{.*}} "-type=aoo"
101-
// FOFFLOAD_STATIC_LIB_SRC4: llvm-link{{.*}} "@{{.*}}"
100+
// FOFFLOAD_STATIC_LIB_SRC4: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
101+
// FOFFLOAD_STATIC_LIB_SRC4: llvm-link{{.*}} "[[OUTLIB]]"
102102
// FOFFLOAD_STATIC_LIB_SRC4: ld{{(.exe)?}}" {{.*}} "-o" "output_name" {{.*}} "-lstdc++" "-z" "relro"
103103

104104
/// ###########################################################################
@@ -110,9 +110,9 @@
110110
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir -foffload-whole-static-lib=%t.a -foffload-whole-static-lib=%t_2.a -### %t.o 2>&1 \
111111
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_WHOLE_STATIC_LIB
112112
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" {{.*}}
113-
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo" {{.*}} "-inputs=[[INPUTA:.+\.a]]"
114-
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=aoo" {{.*}} "-inputs=[[INPUTB:.+\.a]]"
115-
// FOFFLOAD_WHOLE_STATIC_LIB: llvm-link{{.*}} "@{{.*}}"
113+
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTA:.+\.a]]" "-outputs=[[OUTLIBA:.+\.a]]"
114+
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTB:.+\.a]]" "-outputs=[[OUTLIBB:.+\.a]]"
115+
// FOFFLOAD_WHOLE_STATIC_LIB: llvm-link{{.*}} "[[OUTLIBA]]" "[[OUTLIBB]]"
116116
// FOFFLOAD_WHOLE_STATIC_LIB: llvm-spirv{{.*}}
117117
// FOFFLOAD_WHOLE_STATIC_LIB: clang-offload-wrapper{{.*}}
118118
// FOFFLOAD_WHOLE_STATIC_LIB: llc{{.*}}

clang/test/Driver/sycl-offload-tempfile.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
// UNSUPPORTED: system-windows
22
// Test temp file cleanup
3-
/// test behaviors of passing a fat static lib
4-
5-
// Build a fat static lib that will be used for all tests
6-
// RUN: echo "void foo(void) {}" > %t1.cpp
7-
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t1.cpp -c -o %t1_bundle.o
8-
// RUN: llvm-ar cr %t_lib.a %t1_bundle.o
9-
// RUN: touch %t_obj.o
10-
// RUN: mkdir -p %t_dir
11-
// invoke the compiler overriding output temp location
12-
// RUN: env TMPDIR=%t_dir TEMP=%t_dir TMP=%t_dir \
13-
// RUN: %clang -target x86_64-unknown-linux-gnu -### -fsycl %t_obj.o -foffload-static-lib=%t_lib.a 2>&1 | \
14-
// RUN: FileCheck -DDIRNAME=%t_dir --check-prefix=CHECK-TEMPFILE %s
15-
// RUN: not ls %t_dir/*
16-
// CHECK-TEMPFILE: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}" "-outputs=[[DIRNAME]]{{\/|\\}}[[OUTPUT3:.+\.txt]]" "-unbundle"
17-
// CHECK-TEMPFILE: llvm-link{{.*}} "@[[DIRNAME]]{{\/|\\}}[[OUTPUT3]]"
183

194
// RUN: mkdir -p %t_dir
205
// RUN: env TMPDIR=%t_dir TEMP=%t_dir TMP=%t_dir \

clang/test/Driver/sycl-offload-win.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl -fno-sycl-device-lib=all %t-orig.lib %t-orig.obj -### 2>&1 \
1616
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB
1717
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=o" "-targets=host-x86_64-pc-windows-msvc,sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}-orig.obj" "-outputs={{.+}}.{{(o|obj)}},{{.+}}.{{(o|obj)}}" "-unbundle"
18-
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=aoo" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib"{{.+}} "-unbundle"
19-
// FOFFLOAD_STATIC_LIB: llvm-link{{(.exe)?}}{{.*}} "@{{.*}}"
18+
// FOFFLOAD_STATIC_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=a" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib" "-outputs=[[OUTLIB:.+\.a]]" "-unbundle"
19+
// FOFFLOAD_STATIC_LIB: llvm-link{{(.exe)?}}{{.*}} "[[OUTLIB]]"
2020
// FOFFLOAD_STATIC_LIB: link{{(.exe)?}}{{.+}} "{{.*}}-orig.lib"
2121

2222
/// ###########################################################################
@@ -33,8 +33,8 @@
3333
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=o"{{.+}} "-inputs={{.*}}-1.obj"{{.+}} "-unbundle"
3434
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=o"{{.+}} "-inputs={{.*}}-2.obj"{{.+}} "-unbundle"
3535
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=o"{{.+}} "-inputs={{.*}}-3.obj"{{.+}} "-unbundle"
36-
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=aoo" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib"{{.+}} "-unbundle"
37-
// FOFFLOAD_STATIC_LIB_MULTI_O: llvm-link{{(.exe)?}}{{.*}} "@{{.*}}"
36+
// FOFFLOAD_STATIC_LIB_MULTI_O: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=a" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib" "-outputs=[[OUTLIB:.+\.a]]" "-unbundle"
37+
// FOFFLOAD_STATIC_LIB_MULTI_O: llvm-link{{(.exe)?}}{{.*}} "[[OUTLIB]]"
3838
// FOFFLOAD_STATIC_LIB_MULTI_O: link{{(.exe)?}}{{.+}} "{{.*}}-orig.lib"
3939

4040
/// ###########################################################################
@@ -48,9 +48,9 @@
4848
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl %t1.lib %t2.lib %t-orig.obj -### 2>&1 \
4949
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_MULTI_LIB
5050
// FOFFLOAD_STATIC_MULTI_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=o"{{.+}} "-inputs={{.*}}-orig.obj"{{.+}} "-unbundle"
51-
// FOFFLOAD_STATIC_MULTI_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=aoo" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}1.lib"{{.+}} "-unbundle"
52-
// FOFFLOAD_STATIC_MULTI_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=aoo" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}2.lib"{{.+}} "-unbundle"
53-
// FOFFLOAD_STATIC_MULTI_LIB: llvm-link{{(.exe)?}}{{.*}} "@{{.*}}" "@{{.*}}"
51+
// FOFFLOAD_STATIC_MULTI_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=a" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}1.lib" "-outputs=[[OUTLIB1:.+\.a]]" "-unbundle"
52+
// FOFFLOAD_STATIC_MULTI_LIB: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=a" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}2.lib" "-outputs=[[OUTLIB2:.+\.a]]" "-unbundle"
53+
// FOFFLOAD_STATIC_MULTI_LIB: llvm-link{{(.exe)?}}{{.*}} "[[OUTLIB1]]" "[[OUTLIB2]]"
5454
// FOFFLOAD_STATIC_MULTI_LIB: link{{(.exe)?}}{{.+}} "{{.*}}1.lib" "{{.*}}2.lib"
5555

5656
/// ###########################################################################
@@ -90,8 +90,8 @@
9090
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC2
9191
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl -foffload-static-lib=%t-orig.lib %s -### 2>&1 \
9292
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC2
93-
// FOFFLOAD_STATIC_LIB_SRC2: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=aoo" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib"{{.+}} "-unbundle"
94-
// FOFFLOAD_STATIC_LIB_SRC2: llvm-link{{(.exe)?}}{{.*}} "@{{.*}}"
93+
// FOFFLOAD_STATIC_LIB_SRC2: clang-offload-bundler{{(.exe)?}}{{.+}} "-type=a" "-targets=sycl-spir64-{{.+}}-sycldevice" "-inputs={{.*}}-orig.lib" "-outputs=[[OUTLIB:.+\.a]]" "-unbundle"
94+
// FOFFLOAD_STATIC_LIB_SRC2: llvm-link{{(.exe)?}}{{.*}} "[[OUTLIB]]"
9595
// FOFFLOAD_STATIC_LIB_SRC2: link{{(.exe)?}}{{.+}} "{{.*}}-orig.lib"
9696

9797
// Check for /P behaviors

0 commit comments

Comments
 (0)