Skip to content
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
11 changes: 9 additions & 2 deletions clang/lib/Driver/OffloadBundler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,8 @@ clang::CheckBundledSection(const OffloadBundlerConfig &BundlerConfig) {
if (Error Err = FH->ReadHeader(Input.getBuffer()))
return std::move(Err);

StringRef triple = BundlerConfig.TargetNames.front();
auto TargetInfo =
OffloadTargetInfo(BundlerConfig.TargetNames.front(), BundlerConfig);

// Read all the bundles that are in the work list. If we find no bundles we
// assume the file is meant for the host target.
Expand All @@ -2069,7 +2070,13 @@ clang::CheckBundledSection(const OffloadBundlerConfig &BundlerConfig) {
if (!*CurTripleOrErr)
break;

if (*CurTripleOrErr == triple) {
StringRef CurTriple = **CurTripleOrErr;
if (!checkOffloadBundleID(CurTriple))
return createStringError(errc::invalid_argument,
"invalid bundle id read from the bundle");

if (isCodeObjectCompatible(OffloadTargetInfo(CurTriple, BundlerConfig),
TargetInfo)) {
found = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-unknown-linux-gnu-b
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Unbundle object file to use as a reference result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-pc-windows-msvc-b
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: not clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-x86_64-pc-windows-msvc-b
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: clang-offload-bundler -check-section -type=ao -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-pc-windows-msvc
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-pc-windows-msvc-b
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: not clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=sycl-spir64-unknown-unknown-a
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-x86_64-pc-windows-msvc-b
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64-unknown-unknown-c
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_gen-d
// RUN: clang-offload-bundler -check-section -type=aoo -input=%t_bundled.a -targets=host-spir64_x86_64-e

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Unbundle object file to use as a reference result
Expand Down