Package: xz-utils / 5.2.2-1.2


Package Version Patches format
xz-utils 5.2.2-1.2 3.0 (quilt)

Patch series

view the series file
Patch File delta Description
liblzma skip ABI incompatible check when | (download) | 5 5 + 0 - 0 !
src/liblzma/common/common.c | 40 38 + 2 - 0 !
src/liblzma/common/common.h | 4 4 + 0 - 0 !
3 files changed, 47 insertions(+), 2 deletions(-)

 liblzma: skip abi-incompatible check when is loaded
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When liblzma started using ELF symbol versioning at the same time
as a soname bump (2 → 5) and a small increase in the reserved space at
the end of the lzma_stream structure checked by lzma_code, introducing
an unversioned compatibility symbol to ease the transition seemed like
a great idea.  After all:

 - most applications only use one version of the library (
   or and would obviously work fine

 - applications linking to the new version of the library
   ( should use the default, versioned lzma_code symbol so
   errors initializing the reserved space can be noticed

 - symbol versioning should ensure application/library mixtures
   independently making use of both versions of the library also
   work.  Calls using the unversioned symbol names would be resolved
   using the old symbol from or the compatibility symbol
   from, avoiding segfaults and spurious

 - application/library mixtures using both versions of the library and
   passing lzma_stream objects between the two would break, but that
   was never supposed to be supported, anyway.

Three toolchain bugs dash that plan.

Current (2.22) versions of the gold linker cannot be used to build
libraries providing versioned and unversioned symbols with the same
name.  On the other hand, BFD ld doesn't mind.  So GNU gold refuses to
link versions of liblzma including the compatibility symbol (PR12261):

	/usr/bin/ld: error: symbol lzma_code has undefined version

Annoying, but livable.  liblzma with the compatibility symbol just
has to be built with BFD ld.

More importantly, gold does not support linking to libraries providing
versioned and unversioned symbols with the same name.  If I link some
code to a version of liblzma with the compatibility symbol:

	ld -o demo demo.o -llzma

then the documented behavior, implemented by BFD ld, is to interpret
calls to lzma_code as referring to the default version
(lzma_code@XZ_5.0).  Current versions of GNU gold treat such calls as
referring to whichever symbol comes first in's symbol
table.  If the unversioned symbol comes first (and in Debian liblzma5
5.1.1alpha+20110809-3 it does), GNU gold will mislink new applications
to use the unversioned compatibility symbol (PR13521):

	$ -o test.o -llzma
	$ eu-readelf -s | grep lzma_code
	    1: 0000000000000000      0 FUNC    GLOBAL DEFAULT    UNDEF lzma_code
	    5: 0000000000000000      0 FUNC    GLOBAL DEFAULT    UNDEF lzma_code

There is no warning.

Worse, from glibc unpredictably will sometimes use the versioned
symbol to resolve references to the unversioned base version when both
are present (PR12977).

Clearly no one has been testing mixtures of versioned and
unversioned symbols at all, and we cannot trust the symbol resolution
process to do anything in particular for them.

This patch implements an alternative method to implement the same
compatibility goals described above.

 - No more compatibility symbol. will define lzma_code
   only once, with version XZ_5.0.

 - When initializing an lzma_stream object, use dlopen("",
   RTLD_NOLOAD) to detect whether the caller might have been expecting
   the old ABI, and store that information in the private
   stream->internal->liblzma2_compat field.

 - In lzma_code, when checking reserved fields, skip fields past the
   old end of the lzma_stream structure ifying reserved fields if and
   only if this->internal->liblzma2_compat is false.

That's it.  Hopefully this time it will work reliably.

Thanks to Eduard Bloch for noticing PR13521 and to Ian Lance Taylor
for PR12977.

Signed-off-by: Jonathan Nieder <>

liblzma make dlopen based liblzma2 compatibility opt.patch | (download) | 33 31 + 2 - 0 !
src/liblzma/common/common.c | 40 35 + 5 - 0 !
src/liblzma/common/common.h | 2 2 + 0 - 0 !
3 files changed, 68 insertions(+), 7 deletions(-)

 liblzma: make dlopen()-based liblzma2 compatibility optional
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suppose I want to build a statically linked program:

	gcc -static -o app app.c -lrpm -llzma

Suppose further that librpm.a was built against a pre-5.0 version of
liblzma so it does not allocate as much space for reserved fields at
the end of lzma_stream as the current API requires.

(This is a hypothetical scenario 
kfreebsd link against libfreebsd glue.patch | (download) | 7 7 + 0 - 0 !
src/liblzma/ | 4 4 + 0 - 0 !
2 files changed, 11 insertions(+)

 kfreebsd: link against libfreebsd-glue

cpuset_getaffinity() is available on kfreebsd but not in libc but in
libfreebsd-glue. This code adds the library if kfreebsd is detected so
cpuset_getaffinity() can be used.
Without it tuklib_cpucores will detect `cpuset' because the compile test
succeeds and later it fails at link phase.

Patch-Name: kfreebsd-link-against-libfreebsd-glue.patch
Signed-off-by: Sebastian Andrzej Siewior <>