]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
17 months agoTweak the expressions in AUTHORS.
Lasse Collin [Tue, 13 Feb 2024 11:19:10 +0000 (13:19 +0200)] 
Tweak the expressions in AUTHORS.

17 months agoTranslations: Add the man page translators into man page header comment.
Lasse Collin [Tue, 13 Feb 2024 11:07:33 +0000 (13:07 +0200)] 
Translations: Add the man page translators into man page header comment.

It looked odd to only have the original English authors listed
in the header comments of the translated files.

17 months agoTranslations: Translate also messages of lzmainfo.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Translations: Translate also messages of lzmainfo.

lzmainfo has had translation support since 2009 at least but
it was never added to po/POTFILES.in so the messages weren't
translated. It's a very rarely needed tool so it's not too bad.

This also adds src/xz/mytime.c to po/POTFILES.in although there
are no translatable strings. It's simpler this way so that it
won't be forgotten if strings were ever added to that file.

17 months agoTranslations: Add custom .pot header with SPDX license identifier.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Translations: Add custom .pot header with SPDX license identifier.

The same is used for both po/xz.pot and po4a/xz-man.pot.

17 months agoTranslations: po4a/update-po: Add copyright notice to xz-man.pot.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Translations: po4a/update-po: Add copyright notice to xz-man.pot.

All man pages are under 0BSD now so this is simple now.

17 months agoUpdate COPYING about the man pages of the scripts.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Update COPYING about the man pages of the scripts.

17 months agoxzdiff, xzgrep, and xzmore: Rewrite the man pages.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
xzdiff, xzgrep, and xzmore: Rewrite the man pages.

The main reason is a kind of silly one:

xz-man.pot contains strings from all man pages in XZ Utils.
The man pages of xzdiff, xzgrep, and xzmore were under GPLv2
and the rest under 0BSD. Thus xz-man.pot contained strings
under two licences. po4a creates the translated man pages
from the combined 0BSD+GPLv2 xz-man.pot.

I haven't liked this mixing in xz-man.pot but the
Translation Project requires that all man pages must be
in the same .pot file. So a separate xz-man-gpl.pot
wasn't an option.

Since these man pages are short, rewriting them was quick enough.
Now xz-man.pot is entirely under 0BSD and marking the per-file
licenses is simpler.

As a bonus, some wording hopefully is now slightly better
although it's perhaps a matter of taste.

NOTE: In xzgrep.1, the EXIT STATUS section was written by me
in the commit d796b6d7fdb8b7238b277056cf9146cce25db604 so that's
why that section could be taken as is from the old xzgrep.1.

17 months agoxzless: Update man page slightly.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
xzless: Update man page slightly.

The xz tool can decompress three file formats and xzless
has always supported uncompressed files too.

17 months agoTranslations: Change po/Makevars to add a copyright notice to po/xz.pot.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Translations: Change po/Makevars to add a copyright notice to po/xz.pot.

17 months agoTranslations: Update po/Makevars to use the template from gettext 0.22.4.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Translations: Update po/Makevars to use the template from gettext 0.22.4.

Also add SPDX license identifier now that there is a known license.

17 months agoliblzma: Include the SPDX license identifier 0BSD to generated files.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
liblzma: Include the SPDX license identifier 0BSD to generated files.

Perhaps the generated files aren't even copyrightable but
using the same license for them as for the rest of the liblzma
keeps things more consistent for tools that look for license info.

17 months agoliblzma: Fix compilation of price_tablegen.c.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
liblzma: Fix compilation of price_tablegen.c.

It is built and run only manually so this didn't matter
unless one wanted to regenerate the price_table.c.

17 months agoAdd SPDX license identifiers to GPL, LGPL, and FSFULLR files.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Add SPDX license identifiers to GPL, LGPL, and FSFULLR files.

17 months agoAdd SPDX license identifier into 0BSD source code files.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Add SPDX license identifier into 0BSD source code files.

17 months agoliblzma: Sync the AUTHORS fix about SHA-256 to lzma.h.
Lasse Collin [Mon, 12 Feb 2024 21:25:54 +0000 (23:25 +0200)] 
liblzma: Sync the AUTHORS fix about SHA-256 to lzma.h.

17 months agoChange most public domain parts to 0BSD.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
Change most public domain parts to 0BSD.

Translations and doc/xz-file-format.txt and doc/lzma-file-format.txt
were not touched.

COPYING.0BSD was added.

17 months agoFix SHA-256 authors.
Lasse Collin [Fri, 9 Feb 2024 15:20:31 +0000 (17:20 +0200)] 
Fix SHA-256 authors.

The initial commit 5d018dc03549c1ee4958364712fb0c94e1bf2741
in 2007 had a comment in sha256.c that the code is based on
Crypto++ Library 5.5.1. In 2009 the Authors list in sha256.c
and the AUTHORS file was updated with information that the
code had come from Crypto++ but via 7-Zip. I know I had viewed
7-Zip's SHA-256 code but back then the C code has been identical
enough with Crypto++, so I don't why I thought the author info
would need that extra step via 7-Zip for this single file.

Another error is that I had mixed sha.* and shacal2.* files
when checking for author info in Crypto++. The shacal2.* files
aren't related to liblzma's sha256.c and thus Kevin Springle's
code in Crypto++ isn't either.

17 months agoRemove macosx/build.sh.
Lasse Collin [Fri, 9 Feb 2024 15:20:31 +0000 (17:20 +0200)] 
Remove macosx/build.sh.

It was last updated in 2013.

17 months agoDoc: Remove doc/examples_old.
Lasse Collin [Fri, 9 Feb 2024 15:20:31 +0000 (17:20 +0200)] 
Doc: Remove doc/examples_old.

It was good to keep these around in parallel with the newer examples
but I think it's OK to remove the old ones at this point.

18 months agoTests: Add RISC-V filter support in a few places.
Jia Tan [Tue, 13 Feb 2024 14:38:58 +0000 (22:38 +0800)] 
Tests: Add RISC-V filter support in a few places.

18 months agoliblzma: Fix build error if only RISC-V BCJ filter is enabled.
Jia Tan [Tue, 13 Feb 2024 14:37:07 +0000 (22:37 +0800)] 
liblzma: Fix build error if only RISC-V BCJ filter is enabled.

If any other BCJ filter was enabled for encoding or decoding, then this
was not a problem.

18 months agoTranslations: Update the Korean translation.
Jia Tan [Tue, 13 Feb 2024 14:56:24 +0000 (22:56 +0800)] 
Translations: Update the Korean translation.

18 months agoTranslations: Update the Korean man page translations.
Jia Tan [Mon, 12 Feb 2024 17:55:53 +0000 (01:55 +0800)] 
Translations: Update the Korean man page translations.

18 months agoTranslations: Update the Chinese (simplified) translation.
Jia Tan [Mon, 12 Feb 2024 17:53:33 +0000 (01:53 +0800)] 
Translations: Update the Chinese (simplified) translation.

18 months agoxzless: Use ||- in LESSOPEN with with "less" 451 and newer.
Lasse Collin [Fri, 9 Feb 2024 21:21:01 +0000 (23:21 +0200)] 
xzless: Use ||- in LESSOPEN with with "less" 451 and newer.

18 months agoxzless: Use --show-preproc-errors with "less" 632 and newer.
Lasse Collin [Fri, 9 Feb 2024 21:00:05 +0000 (23:00 +0200)] 
xzless: Use --show-preproc-errors with "less" 632 and newer.

This makes "less" show a warning if a decompression error occurred.

18 months agoliblzma: Fix typo discovered by codespell.
Jia Tan [Fri, 9 Feb 2024 15:59:54 +0000 (23:59 +0800)] 
liblzma: Fix typo discovered by codespell.

18 months agoTranslations: Update the Swedish translation.
Jia Tan [Fri, 9 Feb 2024 12:01:06 +0000 (20:01 +0800)] 
Translations: Update the Swedish translation.

18 months agoTranslations: Update the Spanish translation.
Jia Tan [Thu, 8 Feb 2024 12:09:04 +0000 (20:09 +0800)] 
Translations: Update the Spanish translation.

18 months agoTranslations: Update the Spanish translation.
Jia Tan [Wed, 7 Feb 2024 13:34:35 +0000 (21:34 +0800)] 
Translations: Update the Spanish translation.

18 months agoTranslations: Update the Polish translation.
Jia Tan [Wed, 7 Feb 2024 13:28:32 +0000 (21:28 +0800)] 
Translations: Update the Polish translation.

18 months agoTranslations: Update the German translation.
Jia Tan [Wed, 7 Feb 2024 11:40:12 +0000 (19:40 +0800)] 
Translations: Update the German translation.

18 months agoTranslations: Update the German man page translations.
Jia Tan [Wed, 7 Feb 2024 11:27:25 +0000 (19:27 +0800)] 
Translations: Update the German man page translations.

18 months agoTranslations: Update the Romanian translation.
Jia Tan [Tue, 6 Feb 2024 15:44:06 +0000 (23:44 +0800)] 
Translations: Update the Romanian translation.

18 months agoTranslations: Update the Romanian man page translations.
Jia Tan [Tue, 6 Feb 2024 15:45:02 +0000 (23:45 +0800)] 
Translations: Update the Romanian man page translations.

18 months agoTranslations: Update the Ukrainian translation.
Jia Tan [Wed, 7 Feb 2024 12:56:57 +0000 (20:56 +0800)] 
Translations: Update the Ukrainian translation.

18 months agoTranslations: Update the Ukrainian man page translations.
Jia Tan [Tue, 6 Feb 2024 15:30:03 +0000 (23:30 +0800)] 
Translations: Update the Ukrainian man page translations.

18 months agoUpdate AUTHORS.
Jia Tan [Thu, 1 Feb 2024 17:39:28 +0000 (01:39 +0800)] 
Update AUTHORS.

18 months agoliblzma: Update Authors list in crc32_arm64.h.
Jia Tan [Thu, 1 Feb 2024 17:38:51 +0000 (01:38 +0800)] 
liblzma: Update Authors list in crc32_arm64.h.

18 months agoliblzma: Check HAVE_USABLE_CLMUL before omitting CRC32 table.
Jia Tan [Thu, 1 Feb 2024 08:07:03 +0000 (16:07 +0800)] 
liblzma: Check HAVE_USABLE_CLMUL before omitting CRC32 table.

This was split from the prior commit so it could be easily applied to
the 5.4 branch.

Closes: https://github.com/tukaani-project/xz/pull/77
18 months agoliblzma: Check HAVE_USABLE_CLMUL before omitting CRC64 table.
Jia Tan [Thu, 1 Feb 2024 08:06:29 +0000 (16:06 +0800)] 
liblzma: Check HAVE_USABLE_CLMUL before omitting CRC64 table.

If liblzma is configured with --disable-clmul-crc
CFLAGS="-msse4.1 -mpclmul", then it will fail to compile because the
generic version must be used but the CRC tables were not included.

18 months agoliblzma: Only use ifunc in crcXX_fast.c if its needed.
Jia Tan [Tue, 23 Jan 2024 10:02:13 +0000 (18:02 +0800)] 
liblzma: Only use ifunc in crcXX_fast.c if its needed.

The code was using HAVE_FUNC_ATTRIBUTE_IFUNC instead of CRC_USE_IFUNC.
With ARM64, ifunc is incompatible because it requires non-inline
function calls for runtime detection.

18 months agoDocs: Add --disable-arm64-crc32 description to INSTALL.
Jia Tan [Mon, 22 Jan 2024 14:08:45 +0000 (22:08 +0800)] 
Docs: Add --disable-arm64-crc32 description to INSTALL.

18 months agoliblzma: Omit CRC tables when not needed with ARM64 optimizations.
Jia Tan [Mon, 22 Jan 2024 13:36:09 +0000 (21:36 +0800)] 
liblzma: Omit CRC tables when not needed with ARM64 optimizations.

This is similar to the existing x86-64 CLMUL conditions to omit the
tables. They were slightly refactored to improve readability.

18 months agoliblzma: Rename crc32_aarch64.h to crc32_arm64.h.
Jia Tan [Mon, 22 Jan 2024 12:54:56 +0000 (20:54 +0800)] 
liblzma: Rename crc32_aarch64.h to crc32_arm64.h.

Even though the proper name for the architecture is aarch64, this
project uses ARM64 throughout. So the rename is for consistency.

Additionally, crc32_arm64.h was slightly refactored for the following
changes:

   * Added MSVC, FreeBSD, and macOS support in
     is_arch_extension_supported().

   * crc32_arch_optimized() now checks the size when aligning the
     buffer.

   * crc32_arch_optimized() loop conditions were slightly modified to
     avoid both decrementing the size and incrementing the buffer
     pointer.

   * Use the intrinsic wrappers defined in <arm_acle.h> because GCC and
     Clang name them differently.

   * Minor spacing and comment changes.

18 months agoliblzma: Refactor crc_common.h.
Jia Tan [Mon, 22 Jan 2024 12:49:30 +0000 (20:49 +0800)] 
liblzma: Refactor crc_common.h.

The CRC_GENERIC is now split into CRC32_GENERIC and CRC64_GENERIC, since
the ARM64 optimizations will be different between CRC32 and CRC64.

For the same reason, CRC_ARCH_OPTIMIZED is split into
CRC32_ARCH_OPTIMIZED and CRC64_ARCH_OPTIMIZED.

ifunc will only be used with x86-64 CLMUL because the runtime detection
methods needed with ARM64 are not compatible with ifunc.

18 months agoCMake: Add support for ARM64 CRC32 instruction detection.
Jia Tan [Sun, 21 Jan 2024 16:42:28 +0000 (00:42 +0800)] 
CMake: Add support for ARM64 CRC32 instruction detection.

18 months agoBuild: Add support for ARM64 CRC32 instruction detection.
Jia Tan [Sun, 21 Jan 2024 16:36:47 +0000 (00:36 +0800)] 
Build: Add support for ARM64 CRC32 instruction detection.

This adds --enable-arm64-crc32/--disable-arm64-crc32 (enabled by
default) for using the ARM64 CRC32 instruction. This can be disabled if
one knows the binary will never need to run on an ARM64 machine
with this instruction extension.

18 months agoSpeed up CRC32 calculation on ARM64
Chenxi Mao [Tue, 9 Jan 2024 09:23:11 +0000 (17:23 +0800)] 
Speed up CRC32 calculation on ARM64

The CRC32 instructions in ARM64 can calculate the CRC32 result
for 8 bytes in a single operation, making the use of ARM64
instructions much faster compared to the general CRC32 algorithm.

Optimized CRC32 will be enabled if ARM64 has CRC extension
running on Linux.

Signed-off-by: Chenxi Mao <chenxi.mao2013@gmail.com>
18 months agoBump version number for 5.5.1alpha. v5.5.1alpha
Jia Tan [Fri, 26 Jan 2024 11:05:51 +0000 (19:05 +0800)] 
Bump version number for 5.5.1alpha.

18 months agoAdd NEWS for 5.5.1alpha
Jia Tan [Fri, 26 Jan 2024 11:00:52 +0000 (19:00 +0800)] 
Add NEWS for 5.5.1alpha

18 months agoAdd NEWS for 5.4.6.
Jia Tan [Fri, 26 Jan 2024 10:54:24 +0000 (18:54 +0800)] 
Add NEWS for 5.4.6.

18 months agoMove doc/logo/xz-logo.png to "doc" and Doxygen footer to "doxygen".
Lasse Collin [Wed, 24 Jan 2024 18:00:57 +0000 (20:00 +0200)] 
Move doc/logo/xz-logo.png to "doc" and Doxygen footer to "doxygen".

The footer isn't a complete HTML file so having it in the doxygen
directory is a tiny bit clearer.

18 months agoREADME: Add COPYING.CC-BY-SA-4.0 entry to section 1.1.
Jia Tan [Tue, 9 Jan 2024 09:05:01 +0000 (17:05 +0800)] 
README: Add COPYING.CC-BY-SA-4.0 entry to section 1.1.

The Overall documentation section (1.1) table spacing had to be adjusted
since the filename was very long.

18 months agoBuild: Add the logo and license to the release.
Jia Tan [Tue, 9 Jan 2024 08:56:16 +0000 (16:56 +0800)] 
Build: Add the logo and license to the release.

18 months agoCOPYING: Add the license for the XZ logo.
Jia Tan [Tue, 9 Jan 2024 08:44:42 +0000 (16:44 +0800)] 
COPYING: Add the license for the XZ logo.

18 months agoDoxygen: Added the XZ logo and copyright information.
Jia Tan [Tue, 9 Jan 2024 08:40:56 +0000 (16:40 +0800)] 
Doxygen: Added the XZ logo and copyright information.

The PROJECT_LOGO field is now used to include the XZ logo. The footer
of each page now lists the copyright information instead of the default
footer. The license is also copied to statisfy the copyright and so the
link in the documentation can be local.

18 months agoxz: Use threaded mode by defaut (as if --threads=0 was used).
Lasse Collin [Tue, 23 Jan 2024 16:29:28 +0000 (18:29 +0200)] 
xz: Use threaded mode by defaut (as if --threads=0 was used).

This hopefully does more good than bad:

  + It's faster by default.

  + Only the threaded compressor creates files that
    can be decompressed in threaded mode.

  - Compression ratio is worse, usually not too much though.
    When it matters, -T1 must be used.

  - Memory usage increases.

  - Scripts that assume single-threaded mode but don't use -T1 will
    possibly use too much resources, for example, if they run
    multiple xz processes in parallel to compress multiple files.

  - Output from single-threaded and multi-threaded compressors
    differ but such changes could happen for other reasons too
    (they just haven't happened since 5.0.0).

18 months agoCI: Use RISC-V filter when building with BCJ support.
Jia Tan [Tue, 23 Jan 2024 15:52:49 +0000 (23:52 +0800)] 
CI: Use RISC-V filter when building with BCJ support.

18 months agoTests: Use smaller dictionary size in RISC-V test files.
Jia Tan [Tue, 23 Jan 2024 15:52:14 +0000 (23:52 +0800)] 
Tests: Use smaller dictionary size in RISC-V test files.

18 months agoTests: Skip RISC-V test files if decoder was not built.
Jia Tan [Tue, 23 Jan 2024 15:50:57 +0000 (23:50 +0800)] 
Tests: Skip RISC-V test files if decoder was not built.

18 months agoxz: Man page: Add more examples of LZMA2 options with BCJ filters.
Lasse Collin [Tue, 23 Jan 2024 14:11:54 +0000 (16:11 +0200)] 
xz: Man page: Add more examples of LZMA2 options with BCJ filters.

18 months agoliblzma: RISC-V filter: Use byte-by-byte access.
Lasse Collin [Mon, 22 Jan 2024 22:09:48 +0000 (00:09 +0200)] 
liblzma: RISC-V filter: Use byte-by-byte access.

Not all RISC-V processors support fast unaligned access so
it's better to read only one byte in the main loop. This can
be faster even on x86-64 when compared to reading 32 bits at
a time as half the time the address is only 16-bit aligned.

The downside is larger code size on archs that do support
fast unaligned access.

18 months agoxz: Update xz -lvv for RISC-V filter.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
xz: Update xz -lvv for RISC-V filter.

Version 5.6.0 will be shown, even though upcoming alphas and betas
will be able to support this filter. 5.6.0 looks nicer in the output and
people shouldn't be encouraged to use an unstable version in production
in any way.

18 months agoTests: Add two RISC-V Filter test files.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
Tests: Add two RISC-V Filter test files.

These test files achieve 100% code coverage in
src/liblzma/simple/riscv.c. They contain all of the instructions that
should be filtered and a few cases that should not.

18 months agoxz: Update message in --long-help for RISC-V Filter.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
xz: Update message in --long-help for RISC-V Filter.

18 months agoxz: Update the man page for the RISC-V Filter.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
xz: Update the man page for the RISC-V Filter.

A special note was added to suggest using four-byte alignment when the
compressed instruction extension is not present in a RISC-V binary.

18 months agoTests: Add RISC-V Filter test in test_compress.sh.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
Tests: Add RISC-V Filter test in test_compress.sh.

18 months agoliblzma: Update string_conversion.c to support RISC-V Filter.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
liblzma: Update string_conversion.c to support RISC-V Filter.

18 months agoCMake: Support RISC-V BCJ Filter for encoding and decoding.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
CMake: Support RISC-V BCJ Filter for encoding and decoding.

18 months agoliblzma: Add RISC-V BCJ filter.
Jia Tan [Mon, 22 Jan 2024 15:33:39 +0000 (23:33 +0800)] 
liblzma: Add RISC-V BCJ filter.

The new Filter ID is 0x0B.

Thanks to Chien Wong <m@xv97.com> for the initial version of the Filter,
the xz CLI updates, and the Autotools build system modifications.

Thanks to Igor Pavlov for his many contributions to the design of
the filter.

18 months agoDocs: Update .xz file format specification to 1.2.0.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Docs: Update .xz file format specification to 1.2.0.

The new RISC-V filter was added to the specification, in addition to
updating the specification URL.

18 months agoxz: Update website URLs in the man pages.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
xz: Update website URLs in the man pages.

18 months agoliblzma: Update website URL.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
liblzma: Update website URL.

18 months agoDocs: Update website URLs.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Docs: Update website URLs.

18 months agoBuild: Update website URL.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Build: Update website URL.

19 months agoliblzma: CRC: Add a comment to crc_x86_clmul.h about BUILDING_ macros.
Lasse Collin [Thu, 11 Jan 2024 13:01:50 +0000 (15:01 +0200)] 
liblzma: CRC: Add a comment to crc_x86_clmul.h about BUILDING_ macros.

19 months agoliblzma: CRC: Remove crc_always_inline, use lzma_always_inline instead.
Lasse Collin [Thu, 11 Jan 2024 13:22:36 +0000 (15:22 +0200)] 
liblzma: CRC: Remove crc_always_inline, use lzma_always_inline instead.

Now crc_simd_body() in crc_x86_clmul.h is only called once
in a translation unit, we no longer need to be so cautious
about ensuring the always-inline behavior.

19 months agoliblzma: CRC: Update CLMUL comments to more generic wording.
Lasse Collin [Thu, 11 Jan 2024 12:39:46 +0000 (14:39 +0200)] 
liblzma: CRC: Update CLMUL comments to more generic wording.

19 months agoliblzma: Rename arch-specific CRC functions and macros.
Lasse Collin [Wed, 10 Jan 2024 16:23:31 +0000 (18:23 +0200)] 
liblzma: Rename arch-specific CRC functions and macros.

CRC_CLMUL was split to CRC_ARCH_OPTIMIZED and CRC_X86_CLMUL.
CRC_ARCH_OPTIMIZED is defined when an arch-optimized version is used.
Currently the x86 CLMUL implementations are the only arch-optimized
versions, and these also use the CRC_x86_CLMUL macro to tell when
crc_x86_clmul.h needs to be included.

is_clmul_supported() was renamed to is_arch_extension_supported().
crc32_clmul() and crc64_clmul() were renamed to
crc32_arch_optimized() and crc64_arch_optimized().
This way the names make sense with arch-specific non-CLMUL
implementations as well.

19 months agoliblzma: Fix a comment in crc_common.h.
Lasse Collin [Wed, 10 Jan 2024 16:19:21 +0000 (18:19 +0200)] 
liblzma: Fix a comment in crc_common.h.

19 months agoliblzma: Avoid extern lzma_crc32_clmul() and lzma_crc64_clmul().
Lasse Collin [Fri, 20 Oct 2023 20:35:10 +0000 (23:35 +0300)] 
liblzma: Avoid extern lzma_crc32_clmul() and lzma_crc64_clmul().

A CLMUL-only build will have the crcxx_clmul() inlined into
lzma_crcxx(). Previously a jump to the extern lzma_crcxx_clmul()
was needed. Notes about shared liblzma on ELF platforms:

  - On platforms that support ifunc and -fvisibility=hidden, this
    was silly because CLMUL-only build would have that single extra
    jump instruction of extra overhead.

  - On platforms that support neither -fvisibility=hidden nor linker
    version script (liblzma*.map), jumping to lzma_crcxx_clmul()
    would go via PLT so a few more instructions of overhead (still
    not a big issue but silly nevertheless).

There was a downside with static liblzma too: if an application only
needs lzma_crc64(), static linking would make the linker include the
CLMUL code for both CRC32 and CRC64 from crc_x86_clmul.o even though
the CRC32 code wouldn't be needed, thus increasing code size of the
executable (assuming that -ffunction-sections isn't used).

Also, now compilers are likely to inline crc_simd_body()
even if they don't support the always_inline attribute
(or MSVC's __forceinline). Quite possibly all compilers
that build the code do support such an attribute. But now
it likely isn't a problem even if the attribute wasn't supported.

Now all x86-specific stuff is in crc_x86_clmul.h. If other archs
The other archs can then have their own headers with their own
is_clmul_supported() and crcxx_clmul().

Another bonus is that the build system doesn't need to care if
crc_clmul.c is needed.

is_clmul_supported() stays as inline function as it's not needed
when doing a CLMUL-only build (avoids a warning about unused function).

19 months agoliblzma: crc_clmul.c: Add crc_attr_target macro.
Lasse Collin [Fri, 20 Oct 2023 21:06:52 +0000 (00:06 +0300)] 
liblzma: crc_clmul.c: Add crc_attr_target macro.

This reduces the number of the complex #if directives.

19 months agoliblzma: Simplify existing cases with lzma_attr_no_sanitize_address.
Lasse Collin [Fri, 20 Oct 2023 19:49:48 +0000 (22:49 +0300)] 
liblzma: Simplify existing cases with lzma_attr_no_sanitize_address.

19 months agoliblzma: #define crc_attr_no_sanitize_address in crc_common.h.
Lasse Collin [Fri, 20 Oct 2023 18:53:35 +0000 (21:53 +0300)] 
liblzma: #define crc_attr_no_sanitize_address in crc_common.h.

19 months agoliblzma: CRC: Add empty lines.
Lasse Collin [Fri, 20 Oct 2023 20:25:14 +0000 (23:25 +0300)] 
liblzma: CRC: Add empty lines.

And remove one too.

19 months agoliblzma: crc_clmul.c: Tidy up the location of MSVC pragma.
Lasse Collin [Fri, 20 Oct 2023 20:19:33 +0000 (23:19 +0300)] 
liblzma: crc_clmul.c: Tidy up the location of MSVC pragma.

It makes no difference in practice.

19 months agoUpdate THANKS.
Lasse Collin [Wed, 20 Dec 2023 19:16:24 +0000 (21:16 +0200)] 
Update THANKS.

19 months agoliblzma: Use 8-byte method in memcmplen.h on ARM64.
Lasse Collin [Wed, 20 Dec 2023 19:15:16 +0000 (21:15 +0200)] 
liblzma: Use 8-byte method in memcmplen.h on ARM64.

It requires fast unaligned access to 64-bit integers
and a fast instruction to count leading zeros in
a 64-bit integer (__builtin_ctzll()). This perhaps
should be enabled on some other archs too.

Thanks to Chenxi Mao for the original patch:
https://github.com/tukaani-project/xz/pull/75 (the first commit)
According to the numbers there, this may improve encoding
speed by about 3-5 %.

This enables the 8-byte method on MSVC ARM64 too which
should work but wasn't tested.

19 months agoliblzma: Check also for __clang__ in memcmplen.h.
Lasse Collin [Wed, 20 Dec 2023 19:01:06 +0000 (21:01 +0200)] 
liblzma: Check also for __clang__ in memcmplen.h.

This change hopefully makes no practical difference as Clang
likely was detected via __GNUC__ or _MSC_VER already.

19 months agoTranslations: Update the French translation.
Jia Tan [Thu, 21 Dec 2023 13:39:08 +0000 (21:39 +0800)] 
Translations: Update the French translation.

19 months agoxz: Add a comment to Capsicum sandbox setup.
Jia Tan [Thu, 21 Dec 2023 08:39:53 +0000 (16:39 +0800)] 
xz: Add a comment to Capsicum sandbox setup.

This comment is repeated in xzdec.c to help remind us why all the
capabilities are removed from stdin in certain situations.

19 months agoDocs: Update --enable-sandbox option in INSTALL.
Jia Tan [Wed, 20 Dec 2023 14:19:19 +0000 (22:19 +0800)] 
Docs: Update --enable-sandbox option in INSTALL.

xzdec now also uses the sandbox when its configured.

19 months agoCMake: Move sandbox detection outside of xz section.
Jia Tan [Wed, 20 Dec 2023 14:39:13 +0000 (22:39 +0800)] 
CMake: Move sandbox detection outside of xz section.

The sandbox is now enabled for xzdec as well, so it no longer belongs
in just the xz section. xz and xzdec are always built, except for older
MSVC versions, so there isn't a need to conditionally show the sandbox
configuration. CMake will do a little unecessary work on older MSVC
versions that can't build xz or xzdec, but this is a very small
downside.

19 months agoBuild: Allow sandbox to be configured for just xzdec.
Jia Tan [Wed, 20 Dec 2023 14:43:44 +0000 (22:43 +0800)] 
Build: Allow sandbox to be configured for just xzdec.

If xz is disabled, then xzdec can still use the sandbox.

19 months agoxzdec: Add sandbox support for Pledge, Capsicum, and Landlock.
Jia Tan [Tue, 19 Dec 2023 13:18:28 +0000 (21:18 +0800)] 
xzdec: Add sandbox support for Pledge, Capsicum, and Landlock.

A very strict sandbox is used when the last file is decompressed. The
likely most common use case of xzdec is to decompress a single file.
The Pledge sandbox is applied to the entire process with slightly more
relaxed promises, until the last file is processed.

Thanks to Christian Weisgerber for the initial patch adding Pledge
sandboxing.

19 months agoliblzma: Initialize lzma_lz_encoder pointers with NULL.
Jia Tan [Wed, 20 Dec 2023 13:31:34 +0000 (21:31 +0800)] 
liblzma: Initialize lzma_lz_encoder pointers with NULL.

This fixes the recent change to lzma_lz_encoder that used memzero
instead of the NULL constant. On some compilers the NULL constant
(always 0) may not equal the NULL pointer (this only needs to guarentee
to not point to valid memory address).

Later code compares the pointers to the NULL pointer so we must
initialize them with the NULL pointer instead of 0 to guarentee
code correctness.

19 months agoliblzma: Set all values in lzma_lz_encoder to NULL after allocation.
Jia Tan [Sat, 16 Dec 2023 12:51:38 +0000 (20:51 +0800)] 
liblzma: Set all values in lzma_lz_encoder to NULL after allocation.

The first member of lzma_lz_encoder doesn't necessarily need to be set
to NULL since it will always be set before anything tries to use it.
However the function pointer members must be set to NULL since other
functions rely on this NULL value to determine if this behavior is
supported or not.

This fixes a somewhat serious bug, where the options_update() and
set_out_limit() function pointers are not set to NULL. This seems to
have been forgotten since these function pointers were added many years
after the original two (code() and end()).

The problem is that by not setting this to NULL we are relying on the
memory allocation to zero things out if lzma_filters_update() is called
on a LZMA1 encoder. The function pointer for set_out_limit() is less
serious because there is not an API function that could call this in an
incorrect way. set_out_limit() is only called by the MicroLZMA encoder,
which must use LZMA1 where set_out_limit() is always set. Its currently
not possible to call set_out_limit() on an LZMA2 encoder at this time.

So calling lzma_filters_update() on an LZMA1 encoder had undefined
behavior since its possible that memory could be manipulated so the
options_update member pointed to a different instruction sequence.

This is unlikely to be a bug in an existing application since it relies
on calling lzma_filters_update() on an LZMA1 encoder in the first place.
For instance, it does not affect xz because lzma_filters_update() can
only be used when encoding to the .xz format.

This is fixed by using memzero() to set all members of lzma_lz_encoder
to NULL after it is allocated. This ensures this mistake will not occur
here in the future if any additional function pointers are added.

19 months agoliblzma: Tweak a comment.
Jia Tan [Sat, 16 Dec 2023 12:30:55 +0000 (20:30 +0800)] 
liblzma: Tweak a comment.

19 months agoliblzma: Make parameter names in function definition match declaration.
Jia Tan [Sat, 16 Dec 2023 12:28:21 +0000 (20:28 +0800)] 
liblzma: Make parameter names in function definition match declaration.

lzma_raw_encoder() and lzma_raw_encoder_init() used "options" as the
parameter name instead of "filters" (used by the declaration). "filters"
is more clear since the parameter represents the list of filters passed
to the raw encoder, each of which contains filter options.