Letu Ren [Sun, 17 Dec 2023 16:58:38 +0000 (00:58 +0800)]
Only read version information from zlib.h.in
This is a patch for https://github.com/zlib-ng/zlib-ng/commit/cd458c79c7923e76ffdd0e2638bf2a0eed4f3996
As the commit message says: "Add code to extract version information
for both ZLIB and ZLIBNG variants from the zlib.h file."
The logic of ${SUFFIX} is that zlib-ng reads version information after
parse ZLIB_COMPAT before the commit mentioned above. ${SUFFIX} will only
be set by ZLIB_COMPAT and is meaningless before ZLIB_COMPAT.
Letu Ren [Thu, 14 Dec 2023 07:27:08 +0000 (15:27 +0800)]
Remove duplicate enable tests option
There are two identical ZLIB_ENABLE_TESTS option in CMakeLists.txt which
means the latter one is meaningless. This issue is introduced in
https://github.com/zlib-ng/zlib-ng/commit/ce1a64b5147b874a2dd32920765be333f54e7095
which adds the option to top but forgets to remove the original one.
Adam Stylinski [Tue, 7 Nov 2023 20:22:55 +0000 (15:22 -0500)]
Detemplatize adler32_fold_copy for avx512
Measurements show deltas basically in the noise floor for the
benchmarks.
The AVX512 VNNI implementation is a bit special in that it seems to be
be hurt by the clock penalty enough versus a normal copy that a 256 bit
wide variant was warranted.
Adam Stylinski [Fri, 17 Nov 2023 23:26:45 +0000 (18:26 -0500)]
Fix an issue with regard to finishing out the window
if inflate is invoked with Z_FINISH, and it deems a window was not
necessary, there's a corner case where we never checksum the bytes.
Detect this by checking the window size against zero and the value
of the flush parameter.
This should fix issue #1600, and possibly #1565 as well.
Added unit test for inflate with Z_FINISH and no window.
This test decompresses a small git pack object with the text:
"alone in the dark". By providing inflate with Z_FINISH, it should not use a
sliding window according to zlib docs. We purposefully limit the read buffer
size to trigger CHECK mode to bail early.
Hajin Jang [Mon, 25 Sep 2023 17:15:10 +0000 (02:15 +0900)]
Detect -Wno-pedantic-ms-format support in mingw
Use check_c_compiler_flag() feature of CMake to figure out whether this
mingw toolchain has support for -Wno-pedantic-ms-format or not.
This flag will be added only if the toolchain supports it.
Currently, MinGW-w64 GCC has it, and llvm-mingw does not have it.
Hajin Jang [Sun, 10 Sep 2023 09:28:28 +0000 (18:28 +0900)]
Support llvm-mingw toolchain
zlib-ng requires some patches to make it compilable on LLVM-mingw.
1. Add -Wno-pedantic-ms-format only if a toolchain is MinGW GCC.
- llvm-mingw does not support it, causing build to break.
2. Include arm_neon.h instead of arm64_neon.h (aarch64 only).
- arm64_neon.h is MSVC only.
- GCC, Clang does not have arm64_neon.h but arm_neon.h on aarch64.
- Also applied to configure and detect-instrinsics.cmake
Don't run test intrinsic code with native flag in CMake.
Native flag should already determine what code will run on the architecture.
This appears to have just been an extra run check with limited benefits. Any
compiler that compiles code not available on the native platform is buggy and
not our problem.
Deniz Bahadir [Fri, 15 Sep 2023 16:23:27 +0000 (18:23 +0200)]
Match CMAKE_GENERATOR_TOOLSET variable case-insensitive
The Visual Studio CMake generator allows to select different toolsets.
One of these toolsets is Clang-Cl.
However, the generator does accept the toolset name case-agnostic, so it
could be "ClangCl", but also "Clangcl" or "clangcl" or ...
This value will be stored verbatim in variable CMAKE_GENERATOR_TOOLSET
by CMake. Therefore, this variable must be matched case-insensitive,
which is what this commit does.
fixes: #1576
Signed-off-by: Deniz Bahadir <deniz@code.bahadir.email>
Deniz Bahadir [Fri, 15 Sep 2023 13:46:56 +0000 (15:46 +0200)]
Fix examining value of GENERATOR_IS_MULTI_CONFIG
CMake does not define a variable GENERATOR_IS_MULTI_CONFIG by default.
Instead it sets a global property of that name.
In order to examine its value it first has to be retrieved and stored
into a (local) variable, which is what this commit does.
fixes: #1574
Signed-off-by: Deniz Bahadir <deniz@code.bahadir.email>
Mark Adler [Mon, 21 Aug 2023 20:47:27 +0000 (13:47 -0700)]
Avoid compiler complaints if _TIME_BITS defined when building zlib.
zlib does not use time_t, so _TIME_BITS is irrelevant. However it
may be defined anyway as part of a sledgehammer indiscriminately
applied to all builds.
Mark Adler [Mon, 21 Aug 2023 20:43:46 +0000 (13:43 -0700)]
Correct comment in zlib.h on os setting in gzip header.
The comment said that the os is set to 255, when in fact it has
been set to the current os since zlib 1.2.3. Or at least our best
guess at the os made at compile time.
Clean up SSE4.2 support, and no longer use asm fallback or gcc builtin.
Defines changing meaning:
X86_SSE42 used to mean the compiler supports crc asm fallback.
X86_SSE42_CRC_INTRIN used to mean compiler supports SSE4.2 intrinsics.
X86_SSE42 now means compiler supports SSE4.2 intrinsics.
This therefore also fixes the adler32_sse42 checks, since those were depending
on SSE4.2 intrinsics but was mistakenly checking the X86_SSE42 define.
Now the X86_SSE42 define actually means what it appears to.
David Korth [Sat, 15 Jul 2023 14:13:20 +0000 (10:13 -0400)]
Handle ARM64EC as ARM64.
ARM64EC is a new ARM64 variant introduced in Windows 11 that uses an
ABI similar to AMD64, which allows for better interoperability with
emulated AMD64 applications. When enabled in MSVC, it defines _M_AMD64
and _M_ARM64EC, but not _M_ARM64, so we need to check for _M_ARM64EC.
Define an empty __msan_unpoison() without Z_MEMORY_SANITIZER
Currently all the usages of __msan_unpoison() have to be guarded by
"#ifdef Z_MEMORY_SANITIZER". Simplify things by defining an empty
__msan_unpoison() when the code is compiled without MSan.
Use endianess-specific built-in function for gcc < 12 on PowerPC64
* Add support for cross-compiling using clang 13 and later for PowerPC64 little-endian and big-endian
* Fix detection for availability of Power9 intrinsics