Allow bundle size to be 0 in clang-offload-bundler

HIP uses clang-offload-bundler to create fat binary. The bundle for host is empty.
Currently clang-offload-bundler checks if the bundle size is 0 when unbundling.
If so it will exit without unbundling the remaining bundles. This causes
clang-offload-bundler not being able to unbundle fat binaries generated for HIP.

This patch allows bundles size to be 0 when clang-offload-bundler unbundles
input files.

Differential Revision: https://reviews.llvm.org/D58057

llvm-svn: 355419
This commit is contained in:
Yaxun Liu 2019-03-05 17:52:32 +00:00
parent 1af5bd54a8
commit 071949c3af

View File

@ -292,7 +292,7 @@ public:
ReadChars += TripleSize; ReadChars += TripleSize;
// Check if the offset and size make sense. // Check if the offset and size make sense.
if (!Size || !Offset || Offset + Size > FC.size()) if (!Offset || Offset + Size > FC.size())
return; return;
assert(BundlesInfo.find(Triple) == BundlesInfo.end() && assert(BundlesInfo.find(Triple) == BundlesInfo.end() &&