[lld] 1a50213 - [ELF] --compress-debug-sections=zstd: ignore error if zstd was not built with ZSTD_MULTITHREAD

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 13:16:57 PDT 2022


Author: Fangrui Song
Date: 2022-09-22T13:16:50-07:00
New Revision: 1a50213ce7e8aa2a82ab3824cabc7f2a44805681

URL: https://github.com/llvm/llvm-project/commit/1a50213ce7e8aa2a82ab3824cabc7f2a44805681
DIFF: https://github.com/llvm/llvm-project/commit/1a50213ce7e8aa2a82ab3824cabc7f2a44805681.diff

LOG: [ELF] --compress-debug-sections=zstd: ignore error if zstd was not built with ZSTD_MULTITHREAD

Added: 
    

Modified: 
    lld/ELF/OutputSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index a2ba9e5735b9..6c78d1358dff 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -354,10 +354,9 @@ template <class ELFT> void OutputSection::maybeCompress() {
     size_t pos = 0;
 
     ZSTD_CCtx *cctx = ZSTD_createCCtx();
-    size_t ret = ZSTD_CCtx_setParameter(
-        cctx, ZSTD_c_nbWorkers, parallel::strategy.compute_thread_count());
-    if (ZSTD_isError(ret))
-      fatal(Twine("ZSTD_CCtx_setParameter: ") + ZSTD_getErrorName(ret));
+    // Ignore error if zstd was not built with ZSTD_MULTITHREAD.
+    (void)ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers,
+                                 parallel::strategy.compute_thread_count());
     ZSTD_outBuffer zob = {out.data(), out.size(), 0};
     ZSTD_EndDirective directive = ZSTD_e_continue;
     const size_t blockSize = ZSTD_CStreamInSize();


        


More information about the llvm-commits mailing list