Skip to content

Commit

Permalink
[SYCL] link in with -lsycl when -fsycl is used
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Lazarev <[email protected]>
Signed-off-by: Michael D Toguchi <[email protected]>
  • Loading branch information
mdtoguchi authored and vladimirlaz committed Mar 22, 2019
1 parent 971fecd commit afb4152
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,

AddRunTimeLibs(ToolChain, D, CmdArgs, Args);

if (Args.hasArg(options::OPT_fsycl))
CmdArgs.push_back("-lsycl");

if (WantPthread && !isAndroid)
CmdArgs.push_back("-lpthread");

Expand Down
6 changes: 6 additions & 0 deletions clang/test/Driver/sycl-offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,9 @@
// CHK-ADD-TARGETS-UB: 4: clang-offload-wrapper, {3}, object, (device-sycl)
// CHK-ADD-TARGETS-UB: 5: offload, "host-sycl (x86_64-unknown-linux-gnu)" {2}, "device-sycl (spir64-unknown-linux-sycldevice)" {4}, image

/// ###########################################################################

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

0 comments on commit afb4152

Please sign in to comment.