[all-commits] [llvm/llvm-project] f1ca2a: [ELF] Add --compress-section to compress matched n...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Mar 12 10:56:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f1ca2a09671e4d4acc2bea362b39268ed7883b6d
      https://github.com/llvm/llvm-project/commit/f1ca2a09671e4d4acc2bea362b39268ed7883b6d
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-03-12 (Tue, 12 Mar 2024)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/ELF/OutputSections.cpp
    M lld/ELF/OutputSections.h
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    M lld/test/ELF/compress-sections-err.s
    A lld/test/ELF/compress-sections-special.s
    A lld/test/ELF/compress-sections.s
    A lld/test/ELF/linkerscript/compress-sections.s

  Log Message:
  -----------
  [ELF] Add --compress-section to compress matched non-SHF_ALLOC sections

--compress-sections <section-glib>=[none|zlib|zstd] is similar to
--compress-debug-sections but applies to broader sections without the
SHF_ALLOC flag. lld will report an error if a SHF_ALLOC section is
matched. An interesting use case is to compress `.strtab`/`.symtab`,
which consume a significant portion of the file size (15.1% for a
release build of Clang).

An older revision is available at https://reviews.llvm.org/D154641 .
This patch focuses on non-allocated sections for safety. Moving
`maybeCompress` as D154641 does not handle STT_SECTION symbols for
`-r --compress-debug-sections=zlib` (see `relocatable-section-symbol.s`
from #66804).

Since different output sections may use different compression
algorithms, we need CompressedData::type to generalize
config->compressDebugSections.

GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=27452

Link: https://discourse.llvm.org/t/rfc-compress-arbitrary-sections-with-ld-lld-compress-sections/71674

Pull Request: https://github.com/llvm/llvm-project/pull/84855



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list