Skip to content

Commit

Permalink
Merge commit '49053c0a649f4c8bd2b8d97ce915f401fbc0f3d9'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Dec 23, 2023
2 parents 6533f1f + 49053c0 commit cd713ea
Show file tree
Hide file tree
Showing 45 changed files with 867 additions and 321 deletions.
263 changes: 170 additions & 93 deletions CMakeLists.txt

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,10 @@ XZ Utils Installation
win95 Use Windows 95 compatible threads. This
is compatible with Windows XP and later
too. This is the default for 32-bit x86
Windows builds. The `win95' threading is
incompatible with --enable-small.
Windows builds. Unless the compiler
supports __attribute__((__constructor__)),
the `win95' threading is incompatible with
--enable-small.

vista Use Windows Vista compatible threads. The
resulting binaries won't run on Windows XP
Expand Down
74 changes: 74 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,80 @@
XZ Utils Release Notes
======================

5.4.5 (2023-11-01)

* liblzma:

- Use __attribute__((__no_sanitize_address__)) to avoid address
sanitization with CRC64 CLMUL. It uses 16-byte-aligned reads
which can extend past the bounds of the input buffer and
inherently trigger address sanitization errors. This isn't
a bug.

- Fixed an assertion failure that could be triggered by a large
unpadded_size argument. It was verified that there was no
other bug than the assertion failure.

- Fixed a bug that prevented building with Windows Vista
threading when __attribute__((__constructor__)) is not
supported.

* xz now properly handles special files such as "con" or "nul" on
Windows. Before this fix, the following wrote "foo" to the
console and deleted the input file "con_xz":

echo foo | xz > con_xz
xz --suffix=_xz --decompress con_xz

* Build systems:

- Allow builds with Windows win95 threading and small mode when
__attribute__((__constructor__)) is supported.

- Added a new line to liblzma.pc for MSYS2 (Windows):

Cflags.private: -DLZMA_API_STATIC

When compiling code that will link against static liblzma,
the LZMA_API_STATIC macro needs to be defined on Windows.

- CMake specific changes:

* Fixed a bug that allowed CLOCK_MONOTONIC to be used even
if the check for it failed.

* Fixed a bug where configuring CMake multiple times
resulted in HAVE_CLOCK_GETTIME and HAVE_CLOCK_MONOTONIC
not being set.

* Fixed the build with MinGW-w64-based Clang/LLVM 17.
llvm-windres now has more accurate GNU windres emulation
so the GNU windres workaround from 5.4.1 is needed with
llvm-windres version 17 too.

* The import library on Windows is now properly named
"liblzma.dll.a" instead of "libliblzma.dll.a"

* Fixed a bug causing the Ninja Generator to fail on
UNIX-like systems. This bug was introduced in 5.4.0.

* Added a new option to disable CLMUL CRC64.

* A module-definition (.def) file is now created when
building liblzma.dll with MinGW-w64.

* The pkg-config liblzma.pc file is now installed on all
builds except when using MSVC on Windows.

* Added large file support by default for platforms that
need it to handle files larger than 2 GiB. This includes
MinGW-w64, even 64-bit builds.

* Small fixes and improvements to the tests.

* Updated translations: Chinese (simplified) and Esperanto.


5.4.4 (2023-08-02)

* liblzma and xzdec can now build against WASI SDK when threading
Expand Down
4 changes: 4 additions & 0 deletions THANKS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ has been important. :-) In alphabetical order:
- Jakub Bogusz
- Adam Borowski
- Maarten Bosmans
- Lukas Braune
- Benjamin Buch
- Trent W. Buck
- Kevin R. Bulgrien
Expand Down Expand Up @@ -64,6 +65,7 @@ has been important. :-) In alphabetical order:
- Jouk Jansen
- Jun I Jin
- Kiyoshi Kanazawa
- Joona Kannisto
- Per Øyvind Karlsen
- Iouri Kharon
- Thomas Klausner
Expand Down Expand Up @@ -127,6 +129,7 @@ has been important. :-) In alphabetical order:
- Torsten Rupp
- Stephen Sachs
- Jukka Salmi
- Agostino Sarubbo
- Alexandre Sauvé
- Benno Schulenberg
- Andreas Schwab
Expand All @@ -138,6 +141,7 @@ has been important. :-) In alphabetical order:
- Brad Smith
- Bruce Stark
- Pippijn van Steenhoven
- Martin Storsjö
- Jonathan Stott
- Dan Stromberg
- Jia Tan
Expand Down
26 changes: 26 additions & 0 deletions cmake/remove-ordinals.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#############################################################################
#
# remove-ordinals.cmake
#
# Removes the ordinal numbers from a DEF file that has been created by
# GNU ld or LLVM lld option --output-def (when creating a Windows DLL).
# This should be equivalent: sed 's/ \+@ *[0-9]\+//'
#
# Usage:
#
# cmake -DINPUT_FILE=infile.def.in \
# -DOUTPUT_FILE=outfile.def \
# -P remove-ordinals.cmake
#
#############################################################################
#
# Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
#############################################################################

file(READ "${INPUT_FILE}" STR)
string(REGEX REPLACE " +@ *[0-9]+" "" STR "${STR}")
file(WRITE "${OUTPUT_FILE}" "${STR}")
52 changes: 52 additions & 0 deletions cmake/tuklib_large_file_support.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# tuklib_large_file_support.cmake
#
# If off_t is less than 64 bits by default and -D_FILE_OFFSET_BITS=64
# makes off_t become 64-bit, the CMake option LARGE_FILE_SUPPORT is
# provided (ON by default) and -D_FILE_OFFSET_BITS=64 is added to
# the compile definitions if LARGE_FILE_SUPPORT is ON.
#
# Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#

include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CheckCSourceCompiles)

function(tuklib_large_file_support TARGET_OR_ALL)
# MSVC must be handled specially in the C code.
if(MSVC)
return()
endif()

set(TUKLIB_LARGE_FILE_SUPPORT_TEST
"#include <sys/types.h>
int foo[sizeof(off_t) >= 8 ? 1 : -1];
int main(void) { return 0; }")

check_c_source_compiles("${TUKLIB_LARGE_FILE_SUPPORT_TEST}"
TUKLIB_LARGE_FILE_SUPPORT_BY_DEFAULT)

if(NOT TUKLIB_LARGE_FILE_SUPPORT_BY_DEFAULT)
cmake_push_check_state()
# This needs -D.
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
check_c_source_compiles("${TUKLIB_LARGE_FILE_SUPPORT_TEST}"
TUKLIB_LARGE_FILE_SUPPORT_WITH_FOB64)
cmake_pop_check_state()
endif()

if(TUKLIB_LARGE_FILE_SUPPORT_WITH_FOB64)
# Show the option only when _FILE_OFFSET_BITS=64 affects sizeof(off_t).
option(LARGE_FILE_SUPPORT
"Use -D_FILE_OFFSET_BITS=64 to support files larger than 2 GiB."
ON)

if(LARGE_FILE_SUPPORT)
# This must not use -D.
tuklib_add_definitions("${TARGET_OR_ALL}" "_FILE_OFFSET_BITS=64")
endif()
endif()
endfunction()
39 changes: 25 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down Expand Up @@ -840,17 +832,22 @@ AC_C_BIGENDIAN

# __attribute__((__constructor__)) can be used for one-time initializations.
# Use -Werror because some compilers accept unknown attributes and just
# give a warning. If it works this should give no warnings, even
# clang -Weverything should be fine.
# dnl This doesn't need AC_LANG_SOURCE, minimal code is enough.
# give a warning.
#
# FIXME? Unfortunately -Werror can cause trouble if CFLAGS contains options
# that produce warnings for unrelated reasons. For example, GCC and Clang
# support -Wunused-macros which will warn about "#define _GNU_SOURCE 1"
# which will be among the #defines that Autoconf inserts to the beginning of
# the test program. There seems to be no nice way to prevent Autoconf from
# inserting the any defines to the test program.
AC_MSG_CHECKING([if __attribute__((__constructor__)) can be used])
have_func_attribute_constructor=no
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
__attribute__((__constructor__))
static void my_constructor_func(void) { return; }
], [
]])], [
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR], [1],
[Define to 1 if __attribute__((__constructor__))
is supported for functions.])
Expand All @@ -862,6 +859,20 @@ 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.
###############################################################################
Expand Down Expand Up @@ -1098,7 +1109,7 @@ AS_IF([test "$GCC" = yes], [
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $NEW_FLAG -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[void foo(void); void foo(void) { }])], [
[[void foo(void); void foo(void) { }]])], [
AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
AC_MSG_RESULT([yes])
], [
Expand Down
7 changes: 5 additions & 2 deletions doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2277,8 +2277,11 @@ INCLUDE_FILE_PATTERNS =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED = LZMA_API(type)=type \
LZMA_API_IMPORT \
LZMA_API_CALL=
LZMA_API_IMPORT= \
LZMA_API_CALL= \
tuklib_attr_noreturn= \
lzma_attribute(attr)= \
lzma_attr_alloc_size(size)=

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
9 changes: 7 additions & 2 deletions m4/visibility.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# visibility.m4 serial 6
dnl Copyright (C) 2005, 2008, 2010-2020 Free Software Foundation, Inc.
# visibility.m4 serial 8
dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
Expand Down Expand Up @@ -58,6 +58,11 @@ AC_DEFUN([gl_VISIBILITY],
extern __attribute__((__visibility__("default"))) int exportedvar;
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
void dummyfunc (void);
int hiddenvar;
int exportedvar;
int hiddenfunc (void) { return 51; }
int exportedfunc (void) { return 1225736919; }
void dummyfunc (void) {}
]],
[[]])],
Expand Down
Loading

0 comments on commit cd713ea

Please sign in to comment.