[clang] [llvm] [Clang] Support `--offload-compress` for offload binaries (PR #227765)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 20:57:33 PDT 2026


================
@@ -143,10 +143,13 @@ static Error bundleImages() {
 
   SmallString<0> Buffer;
   if (Compress) {
-    if (const char *Reason =
-            compression::getReasonIfUnsupported(CompressionFormat))
+    compression::Format Format = CompressionFormat;
+    if (!CompressionFormat.getNumOccurrences() &&
+        !compression::zstd::isAvailable())
+      Format = compression::Format::Zlib;
----------------
yxsamliu wrote:

When zstd is unavailable, this falls back to zlib but keeps the requested level. Level 12 works for zstd and fails in zlib. Could we check the level for the chosen format and report an error?

https://github.com/llvm/llvm-project/pull/227765


More information about the cfe-commits mailing list