Skip to content

[Driver][SYCL] Allow for -fcf-protection to run on host only #7251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,8 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,

// Diagnose unsupported options only once.
// All sanitizer options are not currently supported.
for (auto A : Args.filtered(options::OPT_fsanitize_EQ))
for (auto A :
Args.filtered(options::OPT_fsanitize_EQ, options::OPT_fcf_protection_EQ))
D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
<< A->getAsString(Args) << getTriple().str();
}
Expand All @@ -725,6 +726,7 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
// compilation.
switch ((options::ID)A->getOption().getID()) {
case options::OPT_fsanitize_EQ:
case options::OPT_fcf_protection_EQ:
break;
default:
DAL->append(A);
Expand Down
20 changes: 15 additions & 5 deletions clang/test/Driver/sycl-unsupported.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/// Diagnose unsupported options specific to SYCL compilations
// RUN: %clangxx -fsycl -fsanitize=address -fsycl-targets=spir64 -### %s 2>&1 \
// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64
// RUN: | FileCheck %s -DARCH=spir64 -DOPT=-fsanitize=address
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -fsanitize=address -### %s 2>&1 \
// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_gen
// RUN: | FileCheck %s -DARCH=spir64_gen -DOPT=-fsanitize=address
// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga -fsanitize=address -### %s 2>&1 \
// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_fpga
// RUN: | FileCheck %s -DARCH=spir64_fpga -DOPT=-fsanitize=address
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsanitize=address -### %s 2>&1 \
// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_x86_64
// SANITIZE: ignoring '-fsanitize=address' option as it is not currently supported for target '[[ARCH]]{{.*}}' [-Woption-ignored]
// RUN: | FileCheck %s -DARCH=spir64_x86_64 -DOPT=-fsanitize=address

// RUN: %clangxx -fsycl -fcf-protection -fsycl-targets=spir64 -### %s 2>&1 \
// RUN: | FileCheck %s -DARCH=spir64 -DOPT=-fcf-protection
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -fcf-protection -### %s 2>&1 \
// RUN: | FileCheck %s -DARCH=spir64_gen -DOPT=-fcf-protection
// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga -fcf-protection -### %s 2>&1 \
// RUN: | FileCheck %s -DARCH=spir64_fpga -DOPT=-fcf-protection
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fcf-protection -### %s 2>&1 \
// RUN: | FileCheck %s -DARCH=spir64_x86_64 -DOPT=-fcf-protection

// CHECK: ignoring '[[OPT]]' option as it is not currently supported for target '[[ARCH]]{{.*}}' [-Woption-ignored]