Compression header enum
authorAlan Modra <amodra@gmail.com>
Mon, 5 Dec 2022 22:13:31 +0000 (08:43 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 6 Dec 2022 01:41:28 +0000 (12:11 +1030)
commit89dbeac7460eaa2c6b0149b8abfac880ecefbfe3
tree8a05d32e7adcc0bb459d06de592ca208605618de
parent8b4d46dfdf2023d3da295fc3748ce67f064e3df0
Compression header enum

Define an enum instead of using ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD
in bfd and binutils, and move some functions from bfd.c to compress.c.
When looking at the COFF/PE debug compression support, I wondered
about extending it to support zstd.  I likely won't do that, but
the compression header ch_type field isn't just ELF specific if these
headers are to be used in COFF/PE too.

bfd/
* bfd.c (bfd_update_compression_header),
(bfd_check_compression_header, bfd_get_compression_header_size),
(bfd_convert_section_size, bfd_convert_section_contents): Move to..
* compress.c: ..here.
(enum compression_type): New.  Use it throughout file.
* elf.c (_bfd_elf_make_section_from_shdr): Replace uses of
ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with ch_compress_zlib and
ch_compress_zstd.
* bfd-in2.h: Regenerate.
binutils/
* readelf.c (process_section_headers, dump_section_as_strings),
(dump_section_as_bytes, load_specific_debug_section): Replace
uses of ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with
ch_compress_zlib and ch_compress_zstd.
bfd/bfd-in2.h
bfd/bfd.c
bfd/compress.c
bfd/elf.c
binutils/readelf.c