From 4cc4bb9c976f66dcb40610e2420a71aedec0747c Mon Sep 17 00:00:00 2001 From: Matthew Krupcale Date: Thu, 27 Jan 2022 20:49:36 -0500 Subject: [PATCH] Add libbutl lz4 patch libbutl bundles lz4[1] and builds it as an amalgamated translation unit in lz4.cxx, but there is a conflicting typdef unalign in lz4.c and xxhash.c. This patch [2] renames the lz4.c typedef to not conflict with that defined in xxhash.c. See also the upstream issue [3]. * build2.spec: add libbutl lz4 patch to Patches and apply during %setup * libbutl-lz4-typdef-unalign.patch: add libbutl lz4 patch [1] https://github.com/lz4/lz4 [2] https://git.build2.org/cgit/libbutl/commit/?id=23c07078a9f2790b96a6ee6a6183911aaec71533 [3] https://github.com/lz4/lz4/issues/1053 --- build2.spec | 3 +++ libbutl-lz4-typdef-unalign.patch | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 libbutl-lz4-typdef-unalign.patch diff --git a/build2.spec b/build2.spec index 0565cec..7e3665a 100644 --- a/build2.spec +++ b/build2.spec @@ -34,6 +34,8 @@ Patch0000: libbuild2-config.install.scope-no-update-for-install.patch Patch0100: build2-disable-test-cc-modules-ppc64le.patch # Upstream https://git.build2.org/cgit/libbutl/commit/?id=c6ea3d784ee920f51de3088437b471c8dd6d70e2 Patch1000: libbutl-openssl-info-overloads.patch +# Upstream https://git.build2.org/cgit/libbutl/commit/?id=23c07078a9f2790b96a6ee6a6183911aaec71533 +Patch1001: libbutl-lz4-typdef-unalign.patch # Upstream https://git.build2.org/cgit/bpkg/commit/?id=073f4ed111b0b10dcbd81fc112f9d66e41f40fac Patch3000: bpkg-openssl-3-pkeyutl.patch @@ -274,6 +276,7 @@ pushd %{name}-%{version} popd pushd libbutl-%{version} %patch -p 1 -P 1000 +%patch -p 1 -P 1001 popd pushd bpkg-%{version} %patch -p 1 -P 3000 diff --git a/libbutl-lz4-typdef-unalign.patch b/libbutl-lz4-typdef-unalign.patch new file mode 100644 index 0000000..8e0fc79 --- /dev/null +++ b/libbutl-lz4-typdef-unalign.patch @@ -0,0 +1,39 @@ +From 23c07078a9f2790b96a6ee6a6183911aaec71533 Mon Sep 17 00:00:00 2001 +From: Boris Kolpackov +Date: Tue, 25 Jan 2022 15:24:25 +0200 +Subject: Rename unalign to LZ4_unalign in lz4.c not to clash with unalign in + xxhash.c + +Upstream issue 1053. +--- + libbutl/lz4.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libbutl/lz4.c b/libbutl/lz4.c +index eac0541..3f0e430 100644 +--- a/libbutl/lz4.c ++++ b/libbutl/lz4.c +@@ -343,14 +343,14 @@ static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } + + /* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ + /* currently only defined for gcc and icc */ +-typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign; ++typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) LZ4_unalign; + +-static U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } +-static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } +-static reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; } ++static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign*)ptr)->u16; } ++static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign*)ptr)->u32; } ++static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalign*)ptr)->uArch; } + +-static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } +-static void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; } ++static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign*)memPtr)->u16 = value; } ++static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign*)memPtr)->u32 = value; } + + #else /* safe and portable access using memcpy() */ + +-- +cgit v1.1 +