From ecb966de308c255bb4735a7307ef9901c643a9de Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 19 Sep 2022 19:34:56 +0300 Subject: liblzma: Add experimental ARM64 BCJ filter with a temporary Filter ID. That is, the Filter ID will be changed once the design is final. The current version will be removed. So files created with the tempoary Filter ID won't be supported in the future. --- src/liblzma/api/lzma/bcj.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/liblzma/api') diff --git a/src/liblzma/api/lzma/bcj.h b/src/liblzma/api/lzma/bcj.h index 8e37538a..ba6cacb9 100644 --- a/src/liblzma/api/lzma/bcj.h +++ b/src/liblzma/api/lzma/bcj.h @@ -49,9 +49,16 @@ * Filter for SPARC binaries. */ +#define LZMA_FILTER_ARM64 LZMA_VLI_C(0x3FDB87B33B27000B) + /**< + * Filter for ARM64 binaries. + * + * \note Unlike the older filters above, this doesn't + * support any options (must be NULL). + */ /** - * \brief Options for BCJ filters + * \brief Options for BCJ filters (except ARM64) * * The BCJ filters never change the size of the data. Specifying options * for them is optional: if pointer to options is NULL, default value is @@ -88,3 +95,29 @@ typedef struct { uint32_t start_offset; } lzma_options_bcj; + +/** + * \brief Options for the ARM64 filter + * + * This filter never changes the size of the data. + * Specifying options is mandatory. + */ +typedef struct { + /** + * \brief How wide range of relative addresses are converted + * + * The ARM64 BL instruction has 26-bit immediate field that encodes + * a relative address as a multiple of four bytes, so the effective + * range is 2^28 bytes (+/-128 MiB). + * + * If width is 28 bits (LZMA_ARM64_WIDTH_MAX), then all BL + * instructions will be converted. This has a downside of some + * false matches that make compression worse. The best value + * depends on the input file and the differences can be significant; + * with large executables the maximum value is sometimes the best. + */ + uint32_t width; +# define LZMA_ARM64_WIDTH_MIN 18 +# define LZMA_ARM64_WIDTH_MAX 28 +# define LZMA_ARM64_WIDTH_DEFAULT 26 +} lzma_options_arm64; -- cgit v1.2.3