Hi Martin, On Mon, Nov 28, 2022 at 02:16:35PM +0100, Martin Liška wrote: > On 10/29/22 00:21, Mark Wielaard wrote: > > Although I like to also have compression working. Then we can also > > add support to src/elfcompress, which makes for a good testcase. See > > tests/run-compress.sh (which has found some subtle memory issues when > > run under valgrind). > > All right, so I'm preparing a full support for ZSTD (both compression and > compression) > and I noticed a refactoring would be handy for compress_section function and > callers > of the function. > > Note right now, there are basically 3 compression types and process_file > function handles basically all combinations of these (3 x 3 options), while > adding ZSTD > support would make it even more complicated. However, ZSTD will behave very > similar to ZLIB > (not zlib-gnu), except a different algorithm will be used. Plus, in order to > distinguish > ZLIB from ZSTD, we need to read GElf_Chdr. > > So what do you think about the refactoring as the first step?
Looks good. I would just add a sanity check that chdr.ch_type is of a known compression type (it is only checked to be not NONE atm). Cheers, Mark