Skip to content

Commit dab8548

Browse files
committed
[SYCL][Driver] Fix problem with -foffload-static-lib with a source file
When compiling from source and using -foffload-static-lib, the host object was not being added to the partial link step. This looks to be a regression from the -foffload-whole-static-lib update. Fixes regression from: 360b25b Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 65da01b commit dab8548

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4462,8 +4462,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
44624462
IA->getInputArg().getOption().hasFlag(options::LinkerInput))
44634463
// Pass the Input along to linker only.
44644464
continue;
4465-
UnbundlerInputs.push_back(LI);
44664465
}
4466+
UnbundlerInputs.push_back(LI);
44674467
}
44684468
const Arg *LastArg;
44694469
auto addUnbundlerInput = [&](types::ID T, const Arg *A) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
// CHK-FPGA-AOCO-PHASES: 10: linker, {0, 9}, image, (host-sycl)
197197
// CHK-FPGA-AOCO-PHASES: 11: compiler, {4}, ir, (device-sycl)
198198
// CHK-FPGA-AOCO-PHASES: 12: input, "[[INPUTA]]", archive
199-
// CHK-FPGA-AOCO-PHASES-LIN: 13: clang-offload-unbundler, {12}, object
199+
// CHK-FPGA-AOCO-PHASES-LIN: 13: clang-offload-unbundler, {9, 12}, object
200200
// CHK-FPGA-AOCO-PHASES-WIN: 13: clang-offload-unbundler, {12}, archive
201201
// CHK-FPGA-AOCO-PHASES: 14: linker, {11, 13}, ir, (device-sycl)
202202
// CHK-FPGA-AOCO-PHASES: 15: llvm-spirv, {14}, spirv, (device-sycl)
@@ -211,7 +211,7 @@
211211
// RUN: %clang_cl -fsycl -fintelfpga -foffload-static-lib=%t_aoco.a -### %s 2>&1 \
212212
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-WIN %s
213213
// CHK-FPGA-AOCO-LIN: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-check-section"
214-
// CHK-FPGA-AOCO-LIN: ld{{.*}} "-r" "-o" "[[PARTLINKOBJ:.+\.o]]" "{{.*}}crt1.o" "{{.*}}crti.o" "[[INPUTLIB]]" "{{.*}}crtn.o"
214+
// CHK-FPGA-AOCO-LIN: ld{{.*}} "-r" "-o" "[[PARTLINKOBJ:.+\.o]]" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}.o" "[[INPUTLIB]]" "{{.*}}crtn.o"
215215
// CHK-FPGA-AOCO-LIN: clang-offload-bundler{{.*}} "-type=oo" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[PARTLINKOBJ]]" "-outputs={{.*}}" "-unbundle"
216216
// CHK-FPGA-AOCO-WIN: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice-coff" "-inputs=[[INPUTLIB:.+\.a]]" "-outputs={{.*}}" "-unbundle"
217217
// CHK-FPGA-AOCO: llvm-link{{.*}} "@{{.*}}" "-o" "[[LINKEDBC:.+\.bc]]"

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
// FOFFLOAD_STATIC_LIB_SRC: 10: linker, {0, 9}, image, (host-sycl)
4949
// FOFFLOAD_STATIC_LIB_SRC: 11: compiler, {4}, ir, (device-sycl)
5050
// FOFFLOAD_STATIC_LIB_SRC: 12: input, "[[INPUTA]]", archive
51-
// FOFFLOAD_STATIC_LIB_SRC: 13: clang-offload-unbundler, {12}, object
51+
// FOFFLOAD_STATIC_LIB_SRC: 13: clang-offload-unbundler, {9, 12}, object
5252
// FOFFLOAD_STATIC_LIB_SRC: 14: linker, {11, 13}, ir, (device-sycl)
5353
// FOFFLOAD_STATIC_LIB_SRC: 15: llvm-spirv, {14}, spirv, (device-sycl)
5454
// FOFFLOAD_STATIC_LIB_SRC: 16: clang-offload-wrapper, {15}, object, (device-sycl)
@@ -59,7 +59,10 @@
5959
// RUN: touch %t.a
6060
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib=%t.a -### %s 2>&1 \
6161
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC2
62-
// FOFFLOAD_STATIC_LIB_SRC2: ld{{(.exe)?}}" "-r" "-o" {{.*}} "[[INPUT:.+\.a]]"
62+
// FOFFLOAD_STATIC_LIB_SRC2: clang{{.*}} "-emit-llvm-bc"
63+
// FOFFLOAD_STATIC_LIB_SRC2: clang{{.*}} "-fsyntax-only"
64+
// FOFFLOAD_STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
65+
// FOFFLOAD_STATIC_LIB_SRC2: ld{{(.exe)?}}" "-r" "-o" {{.*}} "[[HOSTOBJ]]" "[[INPUT:.+\.a]]"
6366
// FOFFLOAD_STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=oo"
6467
// FOFFLOAD_STATIC_LIB_SRC2: llvm-link{{.*}} "@{{.*}}"
6568

0 commit comments

Comments
 (0)