MFC: MFV: xz 5.6.3

(cherry picked from commit 26743408e9ff53ac0e041407c359ed3c17c15596)
This commit is contained in:
Xin LI 2024-12-09 07:20:04 -08:00
parent 679e924056
commit edf0691b19
16 changed files with 1321 additions and 44 deletions

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,7 @@ has been important. :-) In alphabetical order:
- Tomer Chachamu
- Vitaly Chikunov
- Antoine Cœur
- Felix Collin
- Gabi Davar
- İhsan Doğan
- Chris Donawa
@ -69,9 +70,11 @@ has been important. :-) In alphabetical order:
- Hans Jansen
- Jouk Jansen
- Jun I Jin
- Christoph Junghans
- Kiyoshi Kanazawa
- Joona Kannisto
- Per Øyvind Karlsen
- Firas Khalil Khana
- Iouri Kharon
- Thomas Klausner
- Richard Koch
@ -92,6 +95,7 @@ has been important. :-) In alphabetical order:
- Cary Lewis
- Wim Lewis
- Xin Li
- Yifeng Li
- Eric Lindblad
- Lorenzo De Liso
- H.J. Lu
@ -107,9 +111,11 @@ has been important. :-) In alphabetical order:
- Nathan Moinvaziri
- Étienne Mollier
- Conley Moorhous
- Andrew Murray
- Rafał Mużyło
- Adrien Nader
- Evan Nemerson
- Alexander Neumann
- Hongbo Ni
- Jonathan Nieder
- Andre Noll
@ -118,11 +124,13 @@ has been important. :-) In alphabetical order:
- Daniel Packard
- Filip Palian
- Peter Pallinger
- Kai Pastor
- Rui Paulo
- Igor Pavlov
- Diego Elio Pettenò
- Elbert Pol
- Mikko Pouru
- Frank Prochnow
- Rich Prohaska
- Trần Ngọc Quân
- Pavel Raiskup
@ -138,9 +146,12 @@ has been important. :-) In alphabetical order:
- Stephen Sachs
- Jukka Salmi
- Agostino Sarubbo
- Vijay Sarvepalli
- Alexandre Sauvé
- Benno Schulenberg
- Andreas Schwab
- Eli Schwartz
- Peter Seiderer
- Bhargava Shastry
- Dan Shechter
- Stuart Shelton
@ -149,14 +160,18 @@ has been important. :-) In alphabetical order:
- Brad Smith
- Bruce Stark
- Pippijn van Steenhoven
- Tobias Stoeckmann
- Martin Storsjö
- Jonathan Stott
- Dan Stromberg
- Douglas Thor
- Vincent Torri
- Alexey Tourbin
- Paul Townsend
- Mohammed Adnène Trojette
- Orange Tsai
- Taiki Tsunekawa
- Mathieu Vachon
- Maksym Vatsyk
- Loganaden Velvindron
- Patrick J. Volkerding
@ -176,6 +191,10 @@ has been important. :-) In alphabetical order:
- Ryan Young
- Andreas Zieringer
Companies:
- Google
- Sandfly Security
Also thanks to all the people who have participated in the Tukaani project.
I have probably forgot to add some names to the above list. Sorry about

View file

@ -86,9 +86,15 @@
#elif defined(HAVE_SYS_ENDIAN_H)
// *BSDs and Darwin
# include <sys/endian.h>
# define byteswap16(num) bswap16(num)
# define byteswap32(num) bswap32(num)
# define byteswap64(num) bswap64(num)
# ifdef __OpenBSD__
# define byteswap16(num) swap16(num)
# define byteswap32(num) swap32(num)
# define byteswap64(num) swap64(num)
# else
# define byteswap16(num) bswap16(num)
# define byteswap32(num) bswap32(num)
# define byteswap64(num) bswap64(num)
# endif
#elif defined(HAVE_SYS_BYTEORDER_H)
// Solaris
@ -237,7 +243,7 @@
// from the memcpy() method than from simple byte-by-byte shift-or code
// when reading a 32-bit integer:
//
// (1) It may be constructed on stack using using four 8-bit loads,
// (1) It may be constructed on stack using four 8-bit loads,
// four 8-bit stores to stack, and finally one 32-bit load from stack.
//
// (2) Especially with -Os, an actual memcpy() call may be emitted.

View file

@ -306,7 +306,7 @@ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
* number and zero or more flags. Usually flags aren't
* used, so preset is simply a number [0, 9] which match
* the options -0 ... -9 of the xz command line tool.
* Additional flags can be be set using bitwise-or with
* Additional flags can be set using bitwise-or with
* the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.
* \param check Integrity check type to use. See check.h for available
* checks. The xz command line tool defaults to

View file

@ -22,7 +22,7 @@
#define LZMA_VERSION_MINOR 6
/** \brief Patch version number of the liblzma release. */
#define LZMA_VERSION_PATCH 2
#define LZMA_VERSION_PATCH 3
/**
* \brief Version stability marker

View file

@ -34,9 +34,9 @@ typedef void lzma_crc32_dummy;
// Having the declaration here silences clang -Wmissing-variable-declarations.
extern const uint32_t lzma_crc32_table[8][256];
# ifdef WORDS_BIGENDIAN
# include "crc32_table_be.h"
# else
# include "crc32_table_le.h"
# endif
# ifdef WORDS_BIGENDIAN
# include "crc32_table_be.h"
# else
# include "crc32_table_le.h"
# endif
#endif

View file

@ -76,9 +76,9 @@
// NOTE: Keep this and the next check in sync with the macro
// NO_CRC32_TABLE in crc32_table.c
#if defined(HAVE_ARM64_CRC32) && !defined(WORDS_BIGENDIAN)
// Allow ARM64 CRC32 instruction without a runtime check if
// __ARM_FEATURE_CRC32 is defined. GCC and Clang only define this if the
// proper compiler options are used.
// Allow ARM64 CRC32 instruction without a runtime check if
// __ARM_FEATURE_CRC32 is defined. GCC and Clang only define
// this if the proper compiler options are used.
# if defined(__ARM_FEATURE_CRC32)
# define CRC32_ARCH_OPTIMIZED 1
# define CRC32_ARM64 1

View file

@ -266,7 +266,7 @@ crc32_arch_optimized(const uint8_t *buf, size_t size, uint32_t crc)
__m128i v0, v1, v2;
crc_simd_body(buf, size, &v0, &v1, vfold16,
crc_simd_body(buf, size, &v0, &v1, vfold16,
_mm_cvtsi32_si128((int32_t)~crc));
v1 = _mm_xor_si128(
@ -355,12 +355,12 @@ crc64_arch_optimized(const uint8_t *buf, size_t size, uint64_t crc)
__m128i v0, v1, v2;
#if defined(__i386__) || defined(_M_IX86)
crc_simd_body(buf, size, &v0, &v1, vfold16,
crc_simd_body(buf, size, &v0, &v1, vfold16,
_mm_set_epi64x(0, (int64_t)~crc));
#else
// GCC and Clang would produce good code with _mm_set_epi64x
// but MSVC needs _mm_cvtsi64_si128 on x86-64.
crc_simd_body(buf, size, &v0, &v1, vfold16,
crc_simd_body(buf, size, &v0, &v1, vfold16,
_mm_cvtsi64_si128((int64_t)~crc));
#endif
@ -385,6 +385,9 @@ crc64_arch_optimized(const uint8_t *buf, size_t size, uint64_t crc)
#endif // BUILDING_CRC64_CLMUL
// Even though this is an inline function, compile it only when needed.
// This way it won't appear in E2K builds at all.
#if defined(CRC32_GENERIC) || defined(CRC64_GENERIC)
// Inlining this function duplicates the function body in crc32_resolve() and
// crc64_resolve(), but this is acceptable because this is a tiny function.
static inline bool
@ -420,9 +423,10 @@ is_arch_extension_supported(void)
// - ICC's _may_i_use_cpu_feature: the other methods should work too.
// - GCC >= 6 / Clang / ICX __builtin_cpu_supports("pclmul")
//
// CPUID decding is needed with MSVC anyway and older GCC. This keeps
// CPUID decoding is needed with MSVC anyway and older GCC. This keeps
// the feature checks in the build system simpler too. The nice thing
// about __builtin_cpu_supports would be that it generates very short
// code as is it only reads a variable set at startup but a few bytes
// doesn't matter here.
}
#endif

View file

@ -592,13 +592,13 @@ do { \
// *_only = rc_asm_y or _n to include or exclude code marked with them
#define rc_asm_bittree(a, b, first_only, middle_only, last_only) \
first_only( \
"movzw 2(%[probs_base]), %[prob" #a "]\n\t" \
"movzwl 2(%[probs_base]), %[prob" #a "]\n\t" \
"mov $2, %[symbol]\n\t" \
"movzw 4(%[probs_base]), %[prob" #b "]\n\t" \
"movzwl 4(%[probs_base]), %[prob" #b "]\n\t" \
) \
middle_only( \
/* Note the scaling of 4 instead of 2: */ \
"movzw (%[probs_base], %q[symbol], 4), %[prob" #b "]\n\t" \
"movzwl (%[probs_base], %q[symbol], 4), %[prob" #b "]\n\t" \
) \
last_only( \
"add %[symbol], %[symbol]\n\t" \
@ -610,11 +610,11 @@ do { \
"cmovae %[t0], %[range]\n\t" \
\
first_only( \
"movzw 6(%[probs_base]), %[t0]\n\t" \
"movzwl 6(%[probs_base]), %[t0]\n\t" \
"cmovae %[t0], %[prob" #b "]\n\t" \
) \
middle_only( \
"movzw 2(%[probs_base], %q[symbol], 4), %[t0]\n\t" \
"movzwl 2(%[probs_base], %q[symbol], 4), %[t0]\n\t" \
"lea (%q[symbol], %q[symbol]), %[symbol]\n\t" \
"cmovae %[t0], %[prob" #b "]\n\t" \
) \
@ -716,12 +716,12 @@ do { \
#define rc_asm_bittree_rev(a, b, add, dcur, dnext0, dnext1, \
first_only, middle_only, last_only) \
first_only( \
"movzw 2(%[probs_base]), %[prob" #a "]\n\t" \
"movzwl 2(%[probs_base]), %[prob" #a "]\n\t" \
"xor %[symbol], %[symbol]\n\t" \
"movzw 4(%[probs_base]), %[prob" #b "]\n\t" \
"movzwl 4(%[probs_base]), %[prob" #b "]\n\t" \
) \
middle_only( \
"movzw " #dnext0 "(%[probs_base], %q[symbol], 2), " \
"movzwl " #dnext0 "(%[probs_base], %q[symbol], 2), " \
"%[prob" #b "]\n\t" \
) \
\
@ -731,11 +731,11 @@ do { \
"cmovae %[t0], %[range]\n\t" \
\
first_only( \
"movzw 6(%[probs_base]), %[t0]\n\t" \
"movzwl 6(%[probs_base]), %[t0]\n\t" \
"cmovae %[t0], %[prob" #b "]\n\t" \
) \
middle_only( \
"movzw " #dnext1 "(%[probs_base], %q[symbol], 2), %[t0]\n\t" \
"movzwl " #dnext1 "(%[probs_base], %q[symbol], 2), %[t0]\n\t" \
"cmovae %[t0], %[prob" #b "]\n\t" \
) \
\
@ -788,7 +788,7 @@ do { \
uint32_t t_index; \
\
__asm__( \
"movzw (%[probs_base], %q[symbol], 2), %[prob]\n\t" \
"movzwl (%[probs_base], %q[symbol], 2), %[prob]\n\t" \
"mov %[symbol], %[index]\n\t" \
\
"add %[dest], %[t2]\n\t" \
@ -844,7 +844,7 @@ do { \
"and %[offset], %[match_bit]\n\t" \
"add %[match_bit], %[symbol]\n\t" \
\
"movzw (%[probs_base], %q[symbol], 2), %[prob]\n\t" \
"movzwl (%[probs_base], %q[symbol], 2), %[prob]\n\t" \
\
"add %[symbol], %[symbol]\n\t" \
\

View file

@ -46,11 +46,11 @@ arm64_code(void *simple lzma_attribute((__unused__)),
// The full 26-bit immediate is converted.
// The range is +/-128 MiB.
//
// Using the full range is helps quite a lot with
// Using the full range helps quite a lot with
// big executables. Smaller range would reduce false
// positives in non-code sections of the input though
// so this is a compromise that slightly favors big
// files. With the full range only six bits of the 32
// files. With the full range, only six bits of the 32
// need to match to trigger a conversion.
const uint32_t src = instr;
instr = 0x94000000;

View file

@ -149,8 +149,7 @@ lzmainfo(const char *name, FILE *f)
printf("Unknown");
else
printf("%" PRIu64 " MB (%" PRIu64 " bytes)",
(uncompressed_size + 512 * 1024)
/ (1024 * 1024),
(uncompressed_size / 1024 + 512) / 1024,
uncompressed_size);
lzma_options_lzma *opt = filter.options;
@ -160,7 +159,7 @@ lzmainfo(const char *name, FILE *f)
"Literal context bits (lc): %" PRIu32 "\n"
"Literal pos bits (lp): %" PRIu32 "\n"
"Number of pos bits (pb): %" PRIu32 "\n",
(opt->dict_size + 512 * 1024) / (1024 * 1024),
(opt->dict_size / 1024 + 512) / 1024,
my_log2(opt->dict_size), opt->lc, opt->lp, opt->pb);
free(opt);

View file

@ -252,7 +252,6 @@ parse_real(args_info *args, int argc, char **argv)
{ "single-stream", no_argument, NULL, OPT_SINGLE_STREAM },
{ "no-sparse", no_argument, NULL, OPT_NO_SPARSE },
{ "suffix", required_argument, NULL, 'S' },
// { "recursive", no_argument, NULL, 'r' }, // TODO
{ "files", optional_argument, NULL, OPT_FILES },
{ "files0", optional_argument, NULL, OPT_FILES0 },

View file

@ -1178,6 +1178,10 @@ print_totals_basic(void)
totals.uncompressed_size),
checks);
#if defined(__sun) && (defined(__GNUC__) || defined(__clang__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
// Since we print totals only when there are at least two files,
// the English message will always use "%s files". But some other
// languages need different forms for different plurals so we
@ -1189,6 +1193,9 @@ print_totals_basic(void)
totals.files <= ULONG_MAX ? totals.files
: (totals.files % 1000000) + 1000000),
uint64_to_str(totals.files, 0));
#if defined(__sun) && (defined(__GNUC__) || defined(__clang__))
# pragma GCC diagnostic pop
#endif
return;
}

View file

@ -95,7 +95,7 @@ extern void
mytime_sigtstp_handler(int sig lzma_attribute((__unused__)))
{
// Measure how long the process stays in the stopped state and add
// that amount to start_time. This way the the progress indicator
// that amount to start_time. This way the progress indicator
// won't count the stopped time as elapsed time and the estimated
// remaining time won't be confused by the time spent in the
// stopped state.

View file

@ -124,7 +124,7 @@ version(void)
static void
parse_options(int argc, char **argv)
{
static const char short_opts[] = "cdkM:hqQV";
static const char short_opts[] = "cdkhqQV";
static const struct option long_opts[] = {
{ "stdout", no_argument, NULL, 'c' },
{ "to-stdout", no_argument, NULL, 'c' },

View file

@ -214,9 +214,6 @@
/* Define to 1 to enable hc4 match finder. */
#define HAVE_MF_HC4 1
/* Define to 1 if MicroLZMA support is enabled. */
#define HAVE_MICROLZMA 1
/* Define to 1 if you have the <minix/config.h> header file. */
/* #undef HAVE_MINIX_CONFIG_H */
@ -394,7 +391,7 @@
#define PACKAGE_NAME "XZ Utils"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "XZ Utils 5.6.2"
#define PACKAGE_STRING "XZ Utils 5.6.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "xz"
@ -403,7 +400,7 @@
#define PACKAGE_URL "https://tukaani.org/xz/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "5.6.2"
#define PACKAGE_VERSION "5.6.3"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@ -568,7 +565,7 @@
/* Version number of package */
#define VERSION "5.6.2"
#define VERSION "5.6.3"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */