Skip to content

Commit 8e6a3ec

Browse files
authored
[Driver][SYCL] Suppress link warning when dealing with device binaries (#3449)
When performing a link with SYCL device binaries on Windows, a warning is emitted due to the length of the section string used. They are not unique up to 32 characters, causing the linker to emit a warning. Suppress this warning when we are dealing with -fsycl
1 parent b80f13e commit 8e6a3ec

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ void visualstudio::Linker::constructMSVCLibCommand(Compilation &C,
389389
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
390390
Args.hasArg(options::OPT_fintelfpga))
391391
CmdArgs.push_back("/IGNORE:4221");
392+
393+
// Suppress multiple section warning LNK4078
394+
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
395+
CmdArgs.push_back("/IGNORE:4078");
396+
392397
CmdArgs.push_back(
393398
C.getArgs().MakeArgString(Twine("-OUT:") + Output.getFilename()));
394399

@@ -443,6 +448,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
443448
CmdArgs.push_back(
444449
Args.MakeArgString(Twine("-wholearchive:") + A->getValue()));
445450

451+
// Suppress multiple section warning LNK4078
452+
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
453+
CmdArgs.push_back("/IGNORE:4078");
454+
446455
// If the VC environment hasn't been configured (perhaps because the user
447456
// did not run vcvarsall), try to build a consistent link environment. If
448457
// the environment variable is set however, assume the user knows what
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// REQUIRES: clang-driver
2+
// RUN: %clangxx -target x86_64-pc-windows-msvc -fsycl %s -### 2>&1 \
3+
// RUN: | FileCheck %s
4+
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl %s -### 2>&1 \
5+
// RUN: | FileCheck %s
6+
// RUN: %clangxx -target x86_64-pc-windows-msvc -fsycl -fintelfpga -fsycl-link=early %s -### 2>&1 \
7+
// RUN: | FileCheck %s
8+
// RUN: %clangxx -target x86_64-pc-windows-msvc -fsycl -fintelfpga -fsycl-link=image %s -### 2>&1 \
9+
// RUN: | FileCheck %s
10+
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl -fintelfpga -fsycl-link=early %s -### 2>&1 \
11+
// RUN: | FileCheck %s
12+
// RUN: %clang_cl --target=x86_64-pc-windows-msvc -fsycl -fintelfpga -fsycl-link=image %s -### 2>&1 \
13+
// RUN: | FileCheck %s
14+
// CHECK: /IGNORE:4078

0 commit comments

Comments
 (0)