[ClangLinkerWrapper][SPIRV] Fix embed bitcode option (#213137)

We need to pass the right linker option and not try to containerize it.

Fixes two OpenMP offload JIT tests, the other has some front end assert
I will look at.

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Sarnie 2026-07-31 16:49:09 +02:00 committed by GitHub
parent 1505b3e83d
commit 3e65a09adc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View file

@ -586,8 +586,13 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args,
if (SaveTemps && linkerSupportsLTO(Args))
CmdArgs.push_back("-Wl,--save-temps");
if (Args.hasArg(OPT_embed_bitcode))
CmdArgs.push_back("-Wl,--lto-emit-llvm");
if (Args.hasArg(OPT_embed_bitcode)) {
// SPIR-V does not use the LTO linker path, it links bitcode via llvm-link.
if (Triple.isSPIRV())
CmdArgs.push_back("-emit-llvm");
else
CmdArgs.push_back("-Wl,--lto-emit-llvm");
}
// For linking device code with the SYCL offload kind, special handling is
// required. Passing --sycl-link to clang results in a call to
@ -640,7 +645,8 @@ Error containerizeRawImage(std::unique_ptr<MemoryBuffer> &Img, OffloadKind Kind,
const ArgList &Args) {
llvm::Triple Triple(Args.getLastArgValue(OPT_triple_EQ));
if (Kind == OFK_OpenMP && Triple.isSPIRV() &&
Triple.getVendor() == llvm::Triple::Intel)
Triple.getVendor() == llvm::Triple::Intel &&
!Args.hasArg(OPT_embed_bitcode))
return offloading::intel::containerizeOpenMPSPIRVImage(Img, Triple);
return Error::success();
}

View file

@ -29,6 +29,5 @@
// clang-format on
// REQUIRES: gpu
// XFAIL: intelgpu
#include "empty_kernel.inc"

View file

@ -24,6 +24,5 @@
// clang-format on
// REQUIRES: gpu
// XFAIL: intelgpu
#include "empty_kernel.inc"