diff options
author | Alan Modra <amodra@gmail.com> | 2022-10-04 13:14:05 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-10-04 18:42:54 +1030 |
commit | 758dd750bc6d752b290aefdd62048ca2ea5899d4 (patch) | |
tree | 3e7808b8069ea87866143d6d29d917a472ad0a5e /bfd/bfd-in2.h | |
parent | 034235cebd790d4f9a1728043a175d7d7d9338b1 (diff) | |
download | gdb-758dd750bc6d752b290aefdd62048ca2ea5899d4.zip gdb-758dd750bc6d752b290aefdd62048ca2ea5899d4.tar.gz gdb-758dd750bc6d752b290aefdd62048ca2ea5899d4.tar.bz2 |
Support objcopy changing compression to or from zstd
Commit 2cac01e3ffff lacked support for objcopy changing compression
style. Add that support, which meant a rewrite of
bfd_compress_section_contents. In the process I've fixed some memory
leaks.
* compress.c (bfd_is_section_compressed_info): Rename from
bfd_is_section_compressed_with_header and add ch_type param
to return compression header ch_type field.
Update all callers.
(decompress_section_contents): Remove buffer and size params.
Rewrite. Update callers.
(bfd_init_section_compress_status): Free contents on failure.
(bfd_compress_section): Likewise.
* elf.c (_bfd_elf_make_section_from_shdr): Support objcopy
changing between any of the three compression schemes. Report
"unable to compress/decompress" rather than "unable to
initialize compress/decompress status" on compress/decompress
failures.
* bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r-- | bfd/bfd-in2.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5c80956..d9b49a8 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7953,11 +7953,12 @@ bool bfd_get_full_section_contents void bfd_cache_section_contents (asection *sec, void *contents); -bool bfd_is_section_compressed_with_header +bool bfd_is_section_compressed_info (bfd *abfd, asection *section, int *compression_header_size_p, bfd_size_type *uncompressed_size_p, - unsigned int *uncompressed_alignment_power_p); + unsigned int *uncompressed_alignment_power_p, + unsigned int *ch_type); bool bfd_is_section_compressed (bfd *abfd, asection *section); |