Skip to content

Commit afb4152

Browse files
mdtoguchivladimirlaz
authored andcommitted
[SYCL] link in with -lsycl when -fsycl is used
Signed-off-by: Vladimir Lazarev <[email protected]> Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 971fecd commit afb4152

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
521521

522522
AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
523523

524+
if (Args.hasArg(options::OPT_fsycl))
525+
CmdArgs.push_back("-lsycl");
526+
524527
if (WantPthread && !isAndroid)
525528
CmdArgs.push_back("-lpthread");
526529

clang/test/Driver/sycl-offload.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,9 @@
271271
// CHK-ADD-TARGETS-UB: 4: clang-offload-wrapper, {3}, object, (device-sycl)
272272
// CHK-ADD-TARGETS-UB: 5: offload, "host-sycl (x86_64-unknown-linux-gnu)" {2}, "device-sycl (spir64-unknown-linux-sycldevice)" {4}, image
273273

274+
/// ###########################################################################
275+
276+
/// Check for default linking of -lsycl with -fsycl usage
277+
// RUN: %clang -fsycl -target x86_64-unknown-linux-gnu %s -o %t -### 2>&1 | FileCheck -check-prefix=CHECK-LD-SYCL %s
278+
// CHECK-LD-SYCL: "{{.*}}ld{{(.exe)?}}"
279+
// CHECK-LD-SYCL: "-lsycl"

0 commit comments

Comments
 (0)