aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-18liblzma: CRC_USE_GENERIC_FOR_SMALL_INPUTS cannot be used with ifunc.Lasse Collin1-1/+3
2023-10-18liblzma: Include common.h in crc_common.h.Lasse Collin2-1/+3
crc_common.h depends on common.h. The headers include common.h except when there is a reason to not do so.
2023-10-18liblzma: Add include guards to crc_common.h.Jia Tan1-0/+5
2023-10-18liblzma: Add the crc_always_inline macro to crc_simd_body().Jia Tan1-1/+1
Forcing this to be inline has a significant speed improvement at the cost of a few repeated instructions. The compilers tested on did not inline this function since it is large and is used twice in the same translation unit.
2023-10-18liblzma: Create crc_always_inline macro.Jia Tan1-0/+15
This macro must be used instead of the inline keyword. On MSVC, it is a replacement for __forceinline which is an MSVC specific keyword that should not be used with inline (it will issue a warning if it is). It does not use a build system check to determine if __attribute__((__always_inline__)) since all compilers that can use CLMUL extensions (except the special case for MSVC) should support this attribute. If this assumption is incorrect then it will result in a bug report instead of silently producing slow code.
2023-10-18liblzma: Refactor CRC comments.Jia Tan2-72/+53
A detailed description of the three dispatch methods was added. Also, duplicated comments now only appear in crc32_fast.c or were removed from both crc32_fast.c and crc64_fast.c if they appeared in crc_clmul.c.
2023-10-18liblzma: Create crc_clmul.c.Jia Tan5-420/+435
Both crc32_clmul() and crc64_clmul() are now exported from crc32_clmul.c as lzma_crc32_clmul() and lzma_crc64_clmul(). This ensures that is_clmul_supported() (now lzma_is_clmul_supported()) is not duplicated between crc32_fast.c and crc64_fast.c. Also, it encapsulates the complexity of the CLMUL implementations into a single file and reduces the complexity of crc32_fast.c and crc64_fast.c. Before, CLMUL code was present in crc32_fast.c, crc64_fast.c, and crc_common.h. During the conversion, various cleanups were applied to code (thanks to Lasse Collin) including: - Require using semicolons with MASK_/L/H/LH macros. - Variable typing and const handling improvements. - Improvements to comments. - Fixes to the pragmas used. - Removed unneeded variables. - Whitespace improvements. - Fixed CRC_USE_GENERIC_FOR_SMALL_INPUTS handling. - Silenced warnings and removed the need for some #pragmas
2023-10-18liblzma: Define CRC_USE_IFUNC in crc_common.h.Jia Tan3-4/+7
When ifunc is supported, we can define a simpler macro instead of repeating the more complex check in both crc32_fast.c and crc64_fast.c.
2023-10-13liblzma: Added crc32_clmul to crc32_fast.c.Hans Jansen2-11/+255
2023-10-13liblzma: Moved CLMUL CRC logic to crc_common.h.Hans Jansen2-247/+240
crc64_fast.c was updated to use the code from crc_common.h instead.
2023-10-13liblzma: Rename crc_macros.h to crc_common.h.Hans Jansen4-4/+4
2023-09-26liblzma: Update a comment.Lasse Collin1-2/+1
The C standards don't allow an empty translation unit which can be avoided by declaring something, without exporting any symbols. When I committed f644473a211394447824ea00518d0a214ff3f7f2 I had a feeling that some specific toolchain somewhere didn't like empty object files (assembler or maybe "ar" complained) but I cannot find anything to confirm this now. Quite likely I remembered nonsense. I leave this here as a note to my future self. :-)
2023-09-27liblzma: Avoid compiler warning without creating extra symbol.Jia Tan1-2/+1
When the generic fast crc64 method is used, then we omit lzma_crc64_table[][]. Similar to d9166b52cf3458a4da3eb92224837ca8fc208d79, we can avoid compiler warnings with -Wempty-translation-unit (Clang) or -pedantic (GCC) by creating a never used typedef instead of an extra symbol.
2023-09-14liblzma: Mark crc64_clmul() with __attribute__((__no_sanitize_address__)).Lasse Collin1-0/+8
Thanks to Agostino Sarubbo. Fixes: https://github.com/tukaani-project/xz/issues/62
2023-07-19liblzma: Suppress -Wunused-function warning.Jia Tan1-0/+10
Clang 16.0.0 and earlier have a bug that the ifunc resolver function triggers the -Wunused-function warning. The resolver function is static and only "used" by the __attribute__((__ifunc()__)). At this time, the bug is still unresolved, but has been reported: https://github.com/llvm/llvm-project/issues/63957 This is not a problem in GCC.
2023-06-27liblzma: Add ifunc implementation to crc64_fast.c.Lasse Collin1-9/+26
The ifunc method avoids indirection via the function pointer crc64_func. This works on GNU/Linux and probably on FreeBSD too. The previous __attribute((__constructor__)) method is kept for compatibility with ELF platforms which do support ifunc. The ifunc method has some limitations, for example, building liblzma with -fsanitize=address will result in segfaults. The configure option --disable-ifunc must be used for such builds. Thanks to Hans Jansen for the original patch. Closes: https://github.com/tukaani-project/xz/pull/53
2023-03-18Change a few HTTP URLs to HTTPS.Lasse Collin1-1/+1
The xz man page timestamp was intentionally left unchanged.
2023-02-16liblzma: Silence a warning from MSVC.Lasse Collin1-1/+1
It gives C4146 here since unary minus with unsigned integer is still unsigned (which is the intention here). Doing it with substraction makes it clearer and avoids the warning. Thanks to Nathan Moinvaziri for reporting this.
2023-01-12Fix warnings from clang -Wdocumentation.Lasse Collin1-4/+0
2023-01-10liblzma: CLMUL CRC64: Work around a bug in MSVC, second attempt.Lasse Collin1-0/+18
This affects only 32-bit x86 builds. x86-64 is OK as is. I still cannot easily test this myself. The reporter has tested this and it passes the tests included in the CMake build and performance is good: raw CRC64 is 2-3 times faster than the C version of the slice-by-four method. (Note that liblzma doesn't include a MSVC-compatible version of the 32-bit x86 assembly code for the slice-by-four method.) Thanks to Iouri Kharon for figuring out a fix, testing, and benchmarking.
2023-01-10Revert "liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022)."Lasse Collin1-6/+0
This reverts commit 36edc65ab4cf10a131f239acbd423b4510ba52d5. It was reported that it wasn't a good enough fix and MSVC still produced (different kind of) bad code when building for 32-bit x86 if optimizations are enabled. Thanks to Iouri Kharon.
2023-01-09liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022).Lasse Collin1-0/+6
I haven't tested with MSVC myself and there doesn't seem to be information about the problem online, so I'm relying on the bug report. Thanks to Iouri Kharon for the bug report and the patch.
2022-11-14liblzma: Add fast CRC64 for 32/64-bit x86 using SSSE3 + SSE4.1 + CLMUL.Lasse Collin2-9/+461
It also works on E2K as it supports these intrinsics. On x86-64 runtime detection is used so the code keeps working on older processors too. A CLMUL-only build can be done by using -msse4.1 -mpclmul in CFLAGS and this will reduce the library size since the generic implementation and its 8 KiB lookup table will be omitted. On 32-bit x86 this isn't used by default for now because by default on 32-bit x86 the separate assembly file crc64_x86.S is used. If --disable-assembler is used then this new CLMUL code is used the same way as on 64-bit x86. However, a CLMUL-only build (-msse4.1 -mpclmul) won't omit the 8 KiB lookup table on 32-bit x86 due to a currently-missing check for disabled assembler usage. The configure.ac check should be such that the code won't be built if something in the toolchain doesn't support it but --disable-clmul-crc option can be used to unconditionally disable this feature. CLMUL speeds up decompression of files that have compressed very well (assuming CRC64 is used as a check type). It is know that the CLMUL code is significantly slower than the generic code for tiny inputs (especially 1-8 bytes but up to 16 bytes). If that is a real-world problem then there is already a commented-out variant that uses the generic version for small inputs. Thanks to Ilya Kurdyukov for the original patch which was derived from a white paper from Intel [1] (published in 2009) and public domain code from [2] (released in 2016). [1] https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf [2] https://github.com/rawrunprotected/crc
2022-11-14liblzma: Use __attribute__((__constructor__)) if available.Lasse Collin2-0/+12
This uses it for CRC table initializations when using --disable-small. It avoids mythread_once() overhead. It also means that then --disable-small --disable-threads is thread-safe if this attribute is supported.
2022-10-31liblzma: Silence -Wconversion warning from crc64_fast.c.Lasse Collin1-2/+3
2022-02-22liblzma: Use non-executable stack on FreeBSD as on LinuxEd Maste2-4/+4
2020-12-23liblzma: Enable Intel CET in x86 CRC assembly codesH.J. Lu2-0/+18
When Intel CET is enabled, we need to include <cet.h> in assembly codes to mark Intel CET support and add _CET_ENDBR to indirect jump targets. Tested on Intel Tiger Lake under CET enabled Linux.
2020-03-23Typo fixes from fossies.org.Lasse Collin1-1/+1
https://fossies.org/linux/misc/xz-5.2.5.tar.xz/codespell.html
2019-12-31Rename read32ne to aligned_read32ne, and similarly for the others.Lasse Collin2-4/+4
Using the aligned methods requires more care to ensure that the address really is aligned, so it's nicer if the aligned methods are prefixed. The next commit will remove the unaligned_ prefix from the unaligned methods which in liblzma are used in more places than the aligned ones.
2019-06-24liblzma: Silence clang -Wmissing-variable-declarations.Lasse Collin2-0/+6
2016-03-13liblzma: Disable external SHA-256 by default.Lasse Collin1-10/+6
This is the sane thing to do. The conflict with OpenSSL on some OSes and especially that the OS-provided versions can be significantly slower makes it clear that it was a mistake to have the external SHA-256 support enabled by default. Those who want it can now pass --enable-external-sha256 to configure. INSTALL was updated with notes about OSes where this can be a bad idea. The SHA-256 detection code in configure.ac had some bugs that could lead to a build failure in some situations. These were fixed, although it doesn't matter that much now that the external SHA-256 is disabled by default. MINIX >= 3.2.0 uses NetBSD's libc and thus has SHA256_Init in libc instead of libutil. Support for the libutil version was removed.
2015-11-02liblzma: Fix a build failure related to external SHA-256 support.Lasse Collin1-9/+23
If an appropriate header and structure were found by configure, but a library with a usable SHA-256 functions wasn't, the build failed.
2014-08-03liblzma: SHA-256: Optimize the Maj macro slightly.Lasse Collin1-1/+1
The Maj macro is used where multiple things are added together, so making Maj a sum of two expressions allows some extra freedom for the compiler to schedule the instructions. I learned this trick from <http://www.hackersdelight.org/corres.txt>.
2014-08-03liblzma: SHA-256: Optimize the way rotations are done.Lasse Collin1-6/+11
This looks weird because the rotations become sequential, but it helps quite a bit on both 32-bit and 64-bit x86: - It requires fewer instructions on two-operand instruction sets like x86. - It requires one register less which matters especially on 32-bit x86. I hope this doesn't hurt other archs. I didn't invent this idea myself, but I don't remember where I saw it first.
2014-08-03liblzma: SHA-256: Remove the GCC #pragma that became unneeded.Lasse Collin1-5/+0
The unrolling in the previous commit should avoid the situation where a compiler may think that an uninitialized variable might be accessed.
2014-08-03liblzma: SHA-256: Unroll a little more.Lasse Collin1-9/+16
This way a branch isn't needed for each operation to choose between blk0 and blk2, and still the code doesn't grow as much as it would with full unrolling.
2014-08-03liblzma: SHA-256: Do the byteswapping without a temporary buffer.Lasse Collin1-12/+1
2014-01-12liblzma: Remove a useless C99ism from sha256.c.Lasse Collin1-1/+1
Unsurprisingly it makes no difference in compiled output.
2014-01-12Fix typos in comments.Lasse Collin1-1/+1
2012-08-24A few typo fixes to comments and the xz man page.Lasse Collin1-1/+0
Thanks to Jim Meyering.
2011-05-21liblzma: Try to use SHA-256 from the operating system.Lasse Collin2-8/+77
If the operating system libc or other base libraries provide SHA-256, use that instead of our own copy. Note that this doesn't use OpenSSL or libgcrypt or such libraries to avoid creating dependencies to other packages. This supports at least FreeBSD, NetBSD, OpenBSD, Solaris, MINIX, and Darwin. They all provide similar but not identical SHA-256 APIs; everyone is a little different. Thanks to Wim Lewis for the original patch, improvements, and testing.
2011-04-05liblzma: Use TUKLIB_GNUC_REQ to check GCC version in sha256.c.Lasse Collin1-3/+3
2010-02-12Fix jl -> jb in ASM files.Lasse Collin2-3/+3
2010-02-12Use __APPLE__ instead of __MACH__ in ASM files.Lasse Collin2-8/+8
This allows the files to work on HURD. Thanks to Jonathan Nieder.
2009-11-22Add missing consts to pointer casts.Lasse Collin2-4/+5
2009-10-04Use a tuklib module for integer handling.Lasse Collin7-35/+13
This replaces bswap.h and integer.h. The tuklib module uses <byteswap.h> on GNU, <sys/endian.h> on *BSDs and <sys/byteorder.h> on Solaris, which may contain optimized code like inline assembly.
2009-10-02Make liblzma produce the same output on both endiannesses.Lasse Collin1-0/+30
Seems that it is a problem in some cases if the same version of XZ Utils produces different output on different endiannesses, so this commit fixes that problem. The output will still vary between different XZ Utils versions, but I cannot avoid that for now. This commit bloatens the code on big endian systems by 1 KiB, which should be OK since liblzma is bloated already. ;-)
2009-08-31Revert 43f44160b1ddcbf7e5205c37db09b3bebe7226f9Lasse Collin2-10/+4
and use a fix that works on all systems using GNU assembler. Maybe the assembler code is used e.g. on Solaris x86 but let's worry about it if this doesn't work on it.
2009-08-29Fix x86 assembler on GCC 3.Lasse Collin2-4/+10
Thanks to Karl Berry.
2009-06-30Build system fixesLasse Collin2-47/+51
Don't use libtool convenience libraries to avoid recently discovered long-standing subtle but somewhat severe bugs in libtool (at least 1.5.22 and 2.2.6 are affected). It was found when porting XZ Utils to Windows <http://lists.gnu.org/archive/html/libtool/2009-06/msg00070.html> but the problem is significant also e.g. on GNU/Linux. Unless --disable-shared is passed to configure, static library built from a set of convenience libraries will contain PIC objects. That is, while libtool builds non-PIC objects too, only PIC objects will be used from the convenience libraries. On 32-bit x86 (tested on mobile XP2400+), using PIC instead of non-PIC makes the decompressor 10 % slower with the default CFLAGS. So while xz was linked against static liblzma by default, it got the slower PIC objects unless --disable-shared was used. I tend develop and benchmark with --disable-shared due to faster build time, so I hadn't noticed the problem in benchmarks earlier. This commit also adds support for building Windows resources into liblzma and executables.
2009-06-27Hopefully improved portability of the assembler code inLasse Collin2-2/+14
Autotools based builds on Windows.
2009-06-26Basic support for building with Cygwin and MinGW usingLasse Collin2-6/+8
the Autotools based build system. It's not good yet, more fixes will follow.
2009-06-26Fix @variables@ to $(variables) in Makefile.am files.Lasse Collin1-2/+2
Fix the ordering of libgnu.a and LTLIBINTL on the linker command line and added missing LTLIBINTL to tests/Makefile.am.
2009-05-02Use a GCC-specific #pragma instead of GCC-specificLasse Collin2-5/+5
-Wno-uninitialized to silence a bogus warning.
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin15-93/+88
Some minor documentation cleanups were made at the same time.
2009-02-13Improve support for DOS-like systems.Lasse Collin2-6/+6
Here DOS-like means DOS, Windows, and OS/2.
2009-02-09Let the user specify custom CFLAGS on the make commandLasse Collin1-1/+1
line. Previously custom CFLAGS worked only when they were passed to configure.
2009-02-08Add a separate internal function to initialize the CRC32Lasse Collin2-1/+10
table, which is used also by LZ encoder. This was needed because calling lzma_crc32() and ignoring the result is a no-op due to lzma_attr_pure.
2009-02-07Support LZMA_API_STATIC in assembler files toLasse Collin2-0/+6
avoid __declspec(dllexport) equivalent.
2009-02-02Updated the x86 assembler code:Lasse Collin2-22/+144
- Use call/ret pair to get instruction pointer for PIC. - Use PIC only if PIC or __PIC__ is #defined. - The code should work on MinGW and Darwin in addition to GNU/Linux and Solaris.
2009-02-02Modify LZMA_API macro so that it works on Windows withLasse Collin5-6/+6
other compilers than MinGW. This may hurt readability of the API headers slightly, but I don't know any better way to do this.
2009-01-30Remove dangling crc64_init.c.Lasse Collin1-55/+0
2009-01-26Regenerate the CRC tables without trailing blanks.Lasse Collin4-2024/+2024
2009-01-26remove trailing blanks from all but .xz filesJim Meyering2-2/+2
2008-12-31Remove lzma_init() and other init functions from liblzma API.Lasse Collin11-146/+228
Half of developers were already forgetting to use these functions, which could have caused total breakage in some future liblzma version or even now if --enable-small was used. Now liblzma uses pthread_once() to do the initializations unless it has been built with --disable-threads which make these initializations thread-unsafe. When --enable-small isn't used, liblzma currently gets needlessly linked against libpthread (on systems that have it). While it is stupid for now, liblzma will need threads in future anyway, so this stupidity will be temporary only. When --enable-small is used, different code CRC32 and CRC64 is now used than without --enable-small. This made the resulting binary slightly smaller, but the main reason was to clean it up and to handle the lack of lzma_init_check(). The pkg-config file lzma.pc was renamed to liblzma.pc. I'm not sure if it works correctly and portably for static linking (Libs.private includes -pthread or other operating system specific flags). Hopefully someone complains if it is bad. lzma_rc_prices[] is now included as a precomputed array even with --enable-small. It's just 128 bytes now that it uses uint8_t instead of uint32_t. Smaller array seemed to be at least as fast as the more bloated uint32_t array on x86; hopefully it's not bad on other architectures.
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin3-134/+90
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
2008-06-18Update the code to mostly match the new simpler file formatLasse Collin8-95/+110
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
2008-04-25Removed src/liblzma/common/sysdefs.h symlink, which wasLasse Collin2-2/+2
annoying, because "make dist" put two copies of sysdefs.h into the tarball instead of the symlink.
2008-01-26Added note.GNU-stack to x86 assembler files. It is neededLasse Collin2-0/+18
when using non-executable stack.
2008-01-15Fix CRC code in case --enable-small is used.Lasse Collin2-2/+2
2008-01-08More pre-C99 inttypes.h compatibility fixes. Now the codeLasse Collin4-18/+6
should work even if the system has no inttypes.h.
2008-01-06Introduced compatibility with systems that have pre-C99Lasse Collin8-16/+2
or no inttypes.h. This is useful when the compiler has good enough support for C99, but libc headers don't. Changed liblzma API so that sys/types.h and inttypes.h have to be #included before #including lzma.h. On systems that don't have C99 inttypes.h, it's the problem of the applications to provide the required types and macros before #including lzma.h. If lzma.h defined the missing types and macros, it could conflict with third-party applications whose configure has detected that the types are missing and defined them in config.h already. An alternative would have been introducing lzma_uint32 and similar types, but that would just be an extra pain on modern systems.
2007-12-14Use the filename suffix .S instead of .s for assembler filesLasse Collin3-2/+2
so that the preprocessor removes the /* */ style comments, which are not supported by some non-GNU assemblers (Solaris) that otherwise work with this code.
2007-12-14Fixed wrong symbol name in crc64_x86.s.Lasse Collin1-1/+1
2007-12-14Use .globl instead of .global in x86 assembler code forLasse Collin2-2/+2
better portability. Still needs fixing the commenting.
2007-12-09Added missing LZMA_API to the C versions of the CRC functions.Lasse Collin2-2/+2
The x86 assembler versions were already OK.
2007-12-09Imported to git.Lasse Collin21-0/+3596