[PATCH] D31941: [ELF] - Implemented --compress-debug-sections option.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 09:41:05 PDT 2017


ruiu added a comment.

This patch doesn't use multiple cores to compress .debug section contents. In theory, if there are multiple .debug sections, we can compress them separately. Can you do that?

The code that writes section contents into an in-memory buffer looks very similar to code that writes sections to the output file buffer. This needs fixing.

The other approach I can think of is to do everything as a post-process. After writing everything to the output buffer, you scan .debug sections (that are at end of file), compress them in-place, and then shifts them to fill the holes created by data compression. Have you thought about that?



================
Comment at: ELF/Driver.cpp:560
+      return false;
+    if (S == "zlib" || S == "zlib-gabi")
+      return zlib::isAvailable();
----------------
What is `-gabi`?


================
Comment at: ELF/Driver.cpp:562
+      return zlib::isAvailable();
+    // We support only default zlib compression style now.
+    error("unknown --compress-debug-sections value: " + S);
----------------
This is obvious, so remove this comment.


================
Comment at: ELF/Options.td:25
 
+def compress_debug_sections : Joined<["--"], "compress-debug-sections=">,
+  HelpText<"Compresses DWARF debug sections">;
----------------
Why don't you use `J`?


================
Comment at: ELF/OutputSections.cpp:74
+    return;
+  // SHF_COMPRESSED can not be used in conjunction with SHF_ALLOC flag.
+  if (!(Flags & SHF_ALLOC))
----------------
Why?


================
Comment at: ELF/OutputSections.cpp:110
+    std::unique_ptr<zlib::StreamCompression> Compressor =
+        check(zlib::StreamCompression::create(1024));
+    for (size_t I = 0, E = Sections.size(); I != E; ++I) {
----------------
What is `1024`?

Is the default compression level the best for us?


https://reviews.llvm.org/D31941





More information about the llvm-commits mailing list