From a73ceaf4aed15d968b17fafbd1b1606ccbd986e5 Mon Sep 17 00:00:00 2001 From: Yaxun Liu Date: Tue, 5 Mar 2019 17:52:32 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355419 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-offload-bundler/ClangOffloadBundler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 005450d4e0..4e7cdd6c91 100644 --- a/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -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() && -- 2.50.1