[lld] 04d0a69 - [ELF] Fix --compress-debug-sections=zstd when zlib is disabled

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 16:56:50 PDT 2024


Author: Fangrui Song
Date: 2024-05-07T16:56:45-07:00
New Revision: 04d0a691af9e116f651d233c5689863f614d3adf

URL: https://github.com/llvm/llvm-project/commit/04d0a691af9e116f651d233c5689863f614d3adf
DIFF: https://github.com/llvm/llvm-project/commit/04d0a691af9e116f651d233c5689863f614d3adf.diff

LOG: [ELF] Fix --compress-debug-sections=zstd when zlib is disabled

Added: 
    

Modified: 
    lld/ELF/Options.td
    lld/ELF/OutputSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 73a4f9662a561..b9e05a4b1fd5c 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -68,7 +68,7 @@ defm compress_debug_sections:
   MetaVarName<"[none,zlib,zstd]">;
 
 defm compress_sections: EEq<"compress-sections",
-  "Compress output sections that match the glob and do not have the SHF_ALLOC flag."
+  "Compress output sections that match the glob and do not have the SHF_ALLOC flag. "
   "The compression level is <level> (if specified) or a default speed-focused level">,
   MetaVarName<"<section-glob>={none,zlib,zstd}[:level]">;
 

diff  --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 2dbbff06a8908..9c667241360f6 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -438,10 +438,10 @@ template <class ELFT> void OutputSection::maybeCompress() {
     compressed.type = ELFCOMPRESS_ZLIB;
     compressed.checksum = checksum;
   }
+#endif
 
   compressed.shards = std::move(shardsOut);
   flags |= SHF_COMPRESSED;
-#endif
 }
 
 static void writeInt(uint8_t *buf, uint64_t data, uint64_t size) {


        


More information about the llvm-commits mailing list