Skip to content

Commit 244e874

Browse files
authored
[Driver][SYCL] Improve situations where .exe is added for AOT tools (#2467)
Previous fix only allowed for the .exe to be added for 'clang-cl' specific compilations, which did not allow for usage using clang with a windows specific target.
1 parent a46f4da commit 244e874

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ void SYCL::Linker::ConstructJob(Compilation &C, const JobAction &JA,
207207

208208
static const char *makeExeName(Compilation &C, StringRef Name) {
209209
llvm::SmallString<8> ExeName(Name);
210-
if (C.getDriver().IsCLMode())
210+
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
211+
if (HostTC->getTriple().isWindowsMSVCEnvironment())
211212
ExeName.append(".exe");
212213
return C.getArgs().MakeArgString(ExeName);
213214
}

clang/test/Driver/sycl-offload.c

+6
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,16 @@
689689
// Check to be sure that for windows, the 'exe' tools are called
690690
// RUN: %clang_cl -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %s -### 2>&1 \
691691
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-CPU-WIN
692+
// RUN: %clang -target x86_64-pc-windows-msvc -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %s -### 2>&1 \
693+
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-CPU-WIN
692694
// RUN: %clang_cl -fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice %s -### 2>&1 \
693695
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-GEN-WIN
696+
// RUN: %clang -target x86_64-pc-windows-msvc -fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice %s -### 2>&1 \
697+
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-GEN-WIN
694698
// RUN: %clang_cl -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice %s -### 2>&1 \
695699
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-FPGA-WIN
700+
// RUN: %clang -target x86_64-pc-windows-msvc -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice %s -### 2>&1 \
701+
// RUN: | FileCheck %s -check-prefixes=CHK-TOOLS-FPGA-WIN
696702
// CHK-TOOLS-GEN-WIN: ocloc.exe{{.*}}
697703
// CHK-TOOLS-CPU-WIN: opencl-aot.exe{{.*}}
698704
// CHK-TOOLS-FPGA-WIN: aoc.exe{{.*}}

0 commit comments

Comments
 (0)