diff --git a/backport-build-allow-win95-threads-enable-small.patch b/backport-build-allow-win95-threads-enable-small.patch new file mode 100644 index 0000000000000000000000000000000000000000..cdf12aee17a052ae9f1a6f21c5d301214b474d1a --- /dev/null +++ b/backport-build-allow-win95-threads-enable-small.patch @@ -0,0 +1,60 @@ +From de574404c4c2f87aca049f232c38526e3ce092aa Mon Sep 17 00:00:00 2001 +From: Jia Tan +Date: Wed, 9 Aug 2023 20:35:16 +0800 +Subject: [PATCH] Build: Conditionally allow win95 threads and --enable-small. + +When the compiler supports __attribute__((__constructor__)) +mythread_once() is never used, even with --enable-small. A configuration +with win95 threads and --enable-small will compile and be thread safe so +it can be allowed. + +This isn't a very common configuration since MSVC does not support +__attribute__((__constructor__)), but MINGW32 and CLANG32 environments +for MSYS2 can use win95 threads and have +__attribute__((__constructor__)) support. + +--- + configure.ac | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7202188..b9cf44d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -437,14 +437,6 @@ case $enable_threads in + ;; + esac + +-# The Win95 threading lacks thread-safe one-time initialization function. +-# It's better to disallow it instead of allowing threaded but thread-unsafe +-# build. +-if test "x$enable_small$enable_threads" = xyeswin95; then +- AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be +- used at the same time]) +-fi +- + # We use the actual result a little later. + + +@@ -861,6 +853,18 @@ AC_COMPILE_IFELSE([ + ]) + CFLAGS="$OLD_CFLAGS" + ++# The Win95 threading lacks a thread-safe one-time initialization function. ++# The one-time initialization is needed for crc32_small.c and crc64_small.c ++# create the CRC tables. So if small mode is enabled, the threading mode is ++# win95, and the compiler does not support attribute constructor, then we ++# would end up with a multithreaded build that is thread-unsafe. As a ++# result this configuration is not allowed. ++if test "x$enable_small$enable_threads$have_func_attribute_constructor"\ ++ = xyeswin95no; then ++ AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be ++ used at the same time with a compiler that doesn't support ++ __attribute__((__constructor__))]) ++fi + + ############################################################################### + # Checks for library functions. +-- +2.27.0 + diff --git a/xz.spec b/xz.spec index 388216384527c36af56b87caafdea2398f478bcf..7d801001dfc26f52b22e30de368006bf9d500367 100644 --- a/xz.spec +++ b/xz.spec @@ -1,6 +1,6 @@ Name: xz Version: 5.4.4 -Release: 2 +Release: 3 Summary: A free general-purpose data compreession software with LZMA2 algorithm License: GPL-3.0-only URL: http://tukaani.org/xz @@ -8,6 +8,7 @@ Source0: http://tukaani.org/%{name}/%{name}-%{version}.tar.xz Source1: colorxzgrep.sh Source2: colorxzgrep.csh Patch0: backport-liblzma-Add-overflow-check-for-Unpadded-size-in-lzma.patch +Patch1: backport-build-allow-win95-threads-enable-small.patch BuildRequires: perl-interpreter gcc @@ -115,6 +116,9 @@ LD_LIBRARY_PATH=$PWD/src/liblzma/.libs make check %{_mandir}/pt_BR/man1/* %changelog +* Wed May 08 2024 zhangyaqi - 5.4.4-3 +- Build: Conditionally allow win95 threads and --enable-small. + * Tue Apr 30 2024 kouwenqi - 5.4.4-2 - liblzma: Add overflow check for Unpadded size in lzma_index_append