diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-12-07 16:21:26 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-12-07 16:22:49 -0800 |
commit | 9df1ba9a35b86e99138d2a394e3ee0a07f14b44d (patch) | |
tree | 0634f421549291ff651c7fa53fb1cdc26dc7ebad /libbacktrace/internal.h | |
parent | 4bc2d9f6cb1554bdd634f190c325c8d8e4046f42 (diff) | |
download | gcc-9df1ba9a35b86e99138d2a394e3ee0a07f14b44d.zip gcc-9df1ba9a35b86e99138d2a394e3ee0a07f14b44d.tar.gz gcc-9df1ba9a35b86e99138d2a394e3ee0a07f14b44d.tar.bz2 |
libbacktrace: support zstd decompression
Support decompressing --compress-debug-sections=zstd.
* configure.ac: Check for zstd library and
--compress-debug-sections=zstd linker option.
* Makefile.am (zstdtest_*): New targets.
(zstdtest_alloc_*, ctestzstd_*): New targets.
(BUILDTESTS): Add zstdtest, zstdtest_alloc, ctestzstd as
appropriate.
* elf.c (ELFCOMPRESS_ZSTD): Define.
(elf_fetch_bits): Rename from elf_zlib_fetch. Update uses.
(elf_fetch_bits_backward): New static function.
(ZLIB_HUFFMAN_*): Rename from HUFFMAN_*. Update uses.
(ZLIB_TABLE_*): Rename from ZDEBUG_TABLE_*. Update uses.
(ZSTD_TABLE_*): Define.
(struct elf_zstd_fse_entry): Define.
(elf_zstd_read_fse): New static function.
(elf_zstd_build_fse): Likewise.
(lit): Define if BACKTRACE_GENERATE_ZSTD_FSE_TABLES.
(match, offset, next, print_table, main): Likewise.
(elf_zstd_lit_table): New static const array.
(elf_zstd_match_table, elf_zstd_offset_table): Likewise.
(elf_zstd_read_huff): New static function.
(struct elf_zstd_seq_decode): Define.
(elf_zstd_unpack_seq_decode): New static function.
(ZSTD_LIT_*): Define.
(struct elf_zstd_literals): Define.
(elf_zstd_literal_output): New static function.
(ZSTD_LITERAL_LENGTH_BASELINE_OFFSET): Define.
(elf_zstd_literal_length_baseline): New static const array.
(elf_zstd_literal_length_bits): Likewise.
(ZSTD_MATCH_LENGTH_BASELINE_OFFSET): Define.
(elf_zstd_match_length_baseline): New static const array.
(elf_zstd_match_length_bits): Likewise.
(elf_zstd_decompress): New static function.
(ZDEBUG_TABLE_SIZE): New definition.
(elf_uncompress_chdr): Support ELF_COMPRESS_ZSTD.
(backtrace_uncompress_zstd): New function.
(elf_add): Use ZLIB_TABLE_SIZE for zlib-gnu sections.
* internal.h (backtrace_uncompress_zstd): Declare.
* zstdtest.c: New file.
* configure, config.h.in, Makefile.in: Regenerate.
Diffstat (limited to 'libbacktrace/internal.h')
-rw-r--r-- | libbacktrace/internal.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h index 1e5b269..95e8845 100644 --- a/libbacktrace/internal.h +++ b/libbacktrace/internal.h @@ -368,6 +368,15 @@ extern int backtrace_uncompress_zdebug (struct backtrace_state *, unsigned char **uncompressed, size_t *uncompressed_size); +/* A test-only hook for elf_zstd_decompress. */ + +extern int backtrace_uncompress_zstd (struct backtrace_state *, + const unsigned char *compressed, + size_t compressed_size, + backtrace_error_callback, void *data, + unsigned char *uncompressed, + size_t uncompressed_size); + /* A test-only hook for elf_uncompress_lzma. */ extern int backtrace_uncompress_lzma (struct backtrace_state *, |