[ELF] --compress-debug-sections=zstd: ignore error if zstd was not built with ZSTD_MU...
authorFangrui Song <i@maskray.me>
Thu, 22 Sep 2022 20:16:50 +0000 (13:16 -0700)
committerFangrui Song <i@maskray.me>
Thu, 22 Sep 2022 20:16:50 +0000 (13:16 -0700)
lld/ELF/OutputSections.cpp

index a2ba9e5..6c78d13 100644 (file)
@@ -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();