diff options
author | Alan Modra <amodra@gmail.com> | 2022-12-06 08:43:31 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-12-06 12:11:28 +1030 |
commit | 89dbeac7460eaa2c6b0149b8abfac880ecefbfe3 (patch) | |
tree | 8a05d32e7adcc0bb459d06de592ca208605618de /bfd/bfd-in2.h | |
parent | 8b4d46dfdf2023d3da295fc3748ce67f064e3df0 (diff) | |
download | gdb-89dbeac7460eaa2c6b0149b8abfac880ecefbfe3.zip gdb-89dbeac7460eaa2c6b0149b8abfac880ecefbfe3.tar.gz gdb-89dbeac7460eaa2c6b0149b8abfac880ecefbfe3.tar.bz2 |
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.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r-- | bfd/bfd-in2.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 15f3c8c..24f9305 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7286,24 +7286,6 @@ bfd_vma bfd_emul_get_commonpagesize (const char *); char *bfd_demangle (bfd *, const char *, int); -void bfd_update_compression_header - (bfd *abfd, bfd_byte *contents, asection *sec); - -bool bfd_check_compression_header - (bfd *abfd, bfd_byte *contents, asection *sec, - unsigned int *ch_type, - bfd_size_type *uncompressed_size, - unsigned int *uncompressed_alignment_power); - -int bfd_get_compression_header_size (bfd *abfd, asection *sec); - -bfd_size_type bfd_convert_section_size - (bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); - -bool bfd_convert_section_contents - (bfd *ibfd, asection *isec, bfd *obfd, - bfd_byte **ptr, bfd_size_type *ptr_size); - /* Extracted from archive.c. */ symindex bfd_get_next_mapent (bfd *abfd, symindex previous, carsym **sym); @@ -7963,6 +7945,13 @@ bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); /* Extracted from compress.c. */ +enum compression_type +{ + ch_none = 0, + ch_compress_zlib = 1 , /* Compressed with zlib. */ + ch_compress_zstd = 2 /* Compressed with zstd (www.zstandard.org). */ +}; + static inline char * bfd_debug_name_to_zdebug (bfd *abfd, const char *name) { @@ -7988,6 +7977,18 @@ bfd_zdebug_name_to_debug (bfd *abfd, const char *name) return new_name; } +void bfd_update_compression_header + (bfd *abfd, bfd_byte *contents, asection *sec); + +int bfd_get_compression_header_size (bfd *abfd, asection *sec); + +bfd_size_type bfd_convert_section_size + (bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); + +bool bfd_convert_section_contents + (bfd *ibfd, asection *isec, bfd *obfd, + bfd_byte **ptr, bfd_size_type *ptr_size); + bool bfd_get_full_section_contents (bfd *abfd, asection *section, bfd_byte **ptr); @@ -7996,7 +7997,7 @@ bool bfd_is_section_compressed_info int *compression_header_size_p, bfd_size_type *uncompressed_size_p, unsigned int *uncompressed_alignment_power_p, - unsigned int *ch_type); + enum compression_type *ch_type); bool bfd_is_section_compressed (bfd *abfd, asection *section); |