[lld] [ELF] Add --compress-section to compress matched non-SHF_ALLOC sections (PR #84855)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 21:02:00 PDT 2024


MaskRay wrote:

> > > It seems a bit inconsistent to me that, say, `--compress-nonalloc-sections '*bug*=zstd'` can be overridden by `--compress-debug-sections=zlib`, but not by `--compress-debug-sections=none`.
> > 
> > 
> > `=none` can override a previous `=zlib` or `=zstd`. `ld.lld -pie %t.o -o %t --compress-nonalloc-sections '*0=zlib' --compress-nonalloc-sections '*0=none'` in `lld/test/ELF/compress-nonalloc-sections.s` is such an example.
> 
> And still, if the name template in the `--compress-nonalloc-sections` matches debug sections, you cannot use just `--compress-debug-sections=none` to switch compressing debug sections off. Yes, there are possible workarounds to do that, but the most straightforward variant doesn't work.

Sorry, I was confused. I think you are talking about the option precedence. I agree that --compress-debug-sections should win, even if it is `none`.
Added a test that `--compress-debug-sections=none --compress-sections .debug_str=zstd` that disables compression for `.debug_str`.


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


More information about the llvm-commits mailing list