]> granicus.if.org Git - clang/commitdiff
Allow bundle size to be 0 in clang-offload-bundler
authorYaxun Liu <Yaxun.Liu@amd.com>
Tue, 5 Mar 2019 17:52:32 +0000 (17:52 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Tue, 5 Mar 2019 17:52:32 +0000 (17:52 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355419 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-offload-bundler/ClangOffloadBundler.cpp

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