[PATCH] elfcompress: Don't rewrite file if no section data needs to be updated.
Mark Wielaard
mark@klomp.org
Sun Jul 22 15:20:00 GMT 2018
Hi Igor,
On Sun, Jul 22, 2018 at 10:26:19AM +0200, Igor Gnatenko wrote:
> > With --force the file will still always be updated/rewritten even if
> > no section data needs to be (de)compressed.
>
> I have doubts about behavior in last sentence. In --help, it's written
> "Force compression of section even if it would become larger". So usually
> people would use this option just to make sure that it would really
> compress/decompress sections.
It is only used for compression. You can use --force to compress
sections even if that makes the ELF section data larger. This is
arguably useless, so only really used for testing purposes.
> However, if nothing needs
> compression/decompression - why to rewrite file?
Indeed. That is why I wrote this patch. Because it might still change
the file. It might remove some padding between sections, correct
alignment of some data in the file, change permission/ownership, etc.
In general you wouldn't want that if not necessary for (de)compression
of some ELF section data.
Again that is arguably useless, so only really used for testing purposes
to see that elfcompress works correctly.
> Probably we should create
> new option --force-on-noop or -f -f or something like that?
If possible I would like only one option for "do something useless even
if not necessary".
The updated attached patch does update the help text:
-f, --force Force compression of section even if it would
become larger or update/rewrite the file even if
no section would be (de)compressed
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elfcompress-Don-t-rewrite-file-if-no-section-data-ne.patch
Type: text/x-diff
Size: 4379 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20180722/53e473b2/attachment.bin>
More information about the Elfutils-devel
mailing list