From c256956adcd5391c36c7abb55e2ef5423dbcbdb7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 31 Oct 2020 17:52:50 +0100 Subject: [PATCH] elfutils 0.182 --- .gitignore | 1 + elfutils-0.181-array-param.patch | 472 ------------------------------- elfutils-0.181-zstd.patch | 348 ----------------------- elfutils.spec | 27 +- sources | 2 +- 5 files changed, 21 insertions(+), 829 deletions(-) delete mode 100644 elfutils-0.181-array-param.patch delete mode 100644 elfutils-0.181-zstd.patch diff --git a/.gitignore b/.gitignore index f7d1f6e..d0ad04a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ /elfutils-0.179.tar.bz2 /elfutils-0.180.tar.bz2 /elfutils-0.181.tar.bz2 +/elfutils-0.182.tar.bz2 diff --git a/elfutils-0.181-array-param.patch b/elfutils-0.181-array-param.patch deleted file mode 100644 index 5099b1a..0000000 --- a/elfutils-0.181-array-param.patch +++ /dev/null @@ -1,472 +0,0 @@ -commit 09b034419ef16cf39abcd7a2df9d0fe704176d13 -Author: Mark Wielaard -Date: Sat Oct 17 21:22:22 2020 +0200 - - libebl: Remove unused ebl_syscall_abi. - - GCC11 -Warray-parameter warned about ebl_syscall_abi being inconsistently - declared (once with a pointer to int, once with an array of 6 int elements). - Since ebl_syscall_abi isn't actually used and was only implemented for - 3 backends without any tests just remove it. - - Signed-off-by: Mark Wielaard - -diff --git a/backends/Makefile.am b/backends/Makefile.am -index f4052125..3849f457 100644 ---- a/backends/Makefile.am -+++ b/backends/Makefile.am -@@ -40,13 +40,13 @@ modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ - tilegx m68k bpf riscv csky - - i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ -- i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ -+ i386_retval.c i386_regs.c i386_auxv.c \ - i386_initreg.c i386_unwind.c - - sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c - - x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ -- x86_64_retval.c x86_64_regs.c x86_64_syscall.c x86_64_initreg.c \ -+ x86_64_retval.c x86_64_regs.c x86_64_initreg.c \ - x86_64_unwind.c x32_corenote.c - - -@@ -67,7 +67,7 @@ sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ - sparc_cfi.c sparc_initreg.c - - ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ -- ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ -+ ppc_corenote.c ppc_auxv.c ppc_attrs.c \ - ppc_cfi.c ppc_initreg.c - - ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc64_corenote.c \ -diff --git a/backends/i386_init.c b/backends/i386_init.c -index 3f6b9ed1..579e5fad 100644 ---- a/backends/i386_init.c -+++ b/backends/i386_init.c -@@ -52,7 +52,6 @@ i386_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, debugscn_p); - HOOK (eh, return_value_location); - HOOK (eh, register_info); -- HOOK (eh, syscall_abi); - HOOK (eh, auxv_info); - HOOK (eh, disasm); - HOOK (eh, abi_cfi); -diff --git a/backends/i386_syscall.c b/backends/i386_syscall.c -deleted file mode 100644 -index 535dcd86..00000000 ---- a/backends/i386_syscall.c -+++ /dev/null -@@ -1,50 +0,0 @@ --/* Linux/i386 system call ABI in DWARF register numbers. -- Copyright (C) 2008 Red Hat, Inc. -- This file is part of elfutils. -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of either -- -- * the GNU Lesser General Public License as published by the Free -- Software Foundation; either version 3 of the License, or (at -- your option) any later version -- -- or -- -- * the GNU General Public License as published by the Free -- Software Foundation; either version 2 of the License, or (at -- your option) any later version -- -- or both in parallel, as here. -- -- elfutils is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received copies of the GNU General Public License and -- the GNU Lesser General Public License along with this program. If -- not, see . */ -- --#ifdef HAVE_CONFIG_H --# include --#endif -- --#define BACKEND i386_ --#include "libebl_CPU.h" -- --int --i386_syscall_abi (Ebl *ebl __attribute__ ((unused)), -- int *sp, int *pc, int *callno, int args[6]) --{ -- *sp = 4; /* %esp */ -- *pc = 8; /* %eip */ -- *callno = 0; /* %eax */ -- args[0] = 3; /* %ebx */ -- args[1] = 1; /* %ecx */ -- args[2] = 2; /* %edx */ -- args[3] = 6; /* %esi */ -- args[4] = 7; /* %edi */ -- args[5] = 5; /* %ebp */ -- return 0; --} -diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c -index f509aef6..ffc9842c 100644 ---- a/backends/ppc64_init.c -+++ b/backends/ppc64_init.c -@@ -58,7 +58,6 @@ ppc64_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, bss_plt_p); - HOOK (eh, return_value_location); - HOOK (eh, register_info); -- HOOK (eh, syscall_abi); - HOOK (eh, core_note); - HOOK (eh, auxv_info); - HOOK (eh, check_object_attribute); -diff --git a/backends/ppc_init.c b/backends/ppc_init.c -index ac440ab2..08468f8f 100644 ---- a/backends/ppc_init.c -+++ b/backends/ppc_init.c -@@ -54,7 +54,6 @@ ppc_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, bss_plt_p); - HOOK (eh, return_value_location); - HOOK (eh, register_info); -- HOOK (eh, syscall_abi); - HOOK (eh, core_note); - HOOK (eh, auxv_info); - HOOK (eh, check_object_attribute); -diff --git a/backends/ppc_syscall.c b/backends/ppc_syscall.c -deleted file mode 100644 -index b1b9c52b..00000000 ---- a/backends/ppc_syscall.c -+++ /dev/null -@@ -1,53 +0,0 @@ --/* Linux/PPC system call ABI in DWARF register numbers. -- Copyright (C) 2008 Red Hat, Inc. -- This file is part of elfutils. -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of either -- -- * the GNU Lesser General Public License as published by the Free -- Software Foundation; either version 3 of the License, or (at -- your option) any later version -- -- or -- -- * the GNU General Public License as published by the Free -- Software Foundation; either version 2 of the License, or (at -- your option) any later version -- -- or both in parallel, as here. -- -- elfutils is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received copies of the GNU General Public License and -- the GNU Lesser General Public License along with this program. If -- not, see . */ -- --#ifdef HAVE_CONFIG_H --# include --#endif -- --#define BACKEND ppc_ --#include "libebl_CPU.h" -- --int --ppc_syscall_abi (Ebl *ebl __attribute__ ((unused)), -- int *sp, int *pc, int *callno, int args[6]) --{ -- *sp = 1; -- *pc = -1; -- *callno = 0; -- args[0] = 3; -- args[1] = 4; -- args[2] = 5; -- args[3] = 6; -- args[4] = 7; -- args[5] = 8; -- return 0; --} -- --__typeof (ppc_syscall_abi) --ppc64_syscall_abi __attribute__ ((alias ("ppc_syscall_abi"))); -diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c -index 44c1ad28..8db9b643 100644 ---- a/backends/x86_64_init.c -+++ b/backends/x86_64_init.c -@@ -56,7 +56,6 @@ x86_64_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, core_note); - HOOK (eh, return_value_location); - HOOK (eh, register_info); -- HOOK (eh, syscall_abi); - HOOK (eh, auxv_info); - HOOK (eh, disasm); - HOOK (eh, abi_cfi); -diff --git a/backends/x86_64_syscall.c b/backends/x86_64_syscall.c -deleted file mode 100644 -index 0deb8bad..00000000 ---- a/backends/x86_64_syscall.c -+++ /dev/null -@@ -1,50 +0,0 @@ --/* Linux/x86-64 system call ABI in DWARF register numbers. -- Copyright (C) 2008 Red Hat, Inc. -- This file is part of elfutils. -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of either -- -- * the GNU Lesser General Public License as published by the Free -- Software Foundation; either version 3 of the License, or (at -- your option) any later version -- -- or -- -- * the GNU General Public License as published by the Free -- Software Foundation; either version 2 of the License, or (at -- your option) any later version -- -- or both in parallel, as here. -- -- elfutils is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received copies of the GNU General Public License and -- the GNU Lesser General Public License along with this program. If -- not, see . */ -- --#ifdef HAVE_CONFIG_H --# include --#endif -- --#define BACKEND x86_64_ --#include "libebl_CPU.h" -- --int --x86_64_syscall_abi (Ebl *ebl __attribute__ ((unused)), -- int *sp, int *pc, int *callno, int args[6]) --{ -- *sp = 7; /* %rsp */ -- *pc = 16; /* %rip */ -- *callno = 0; /* %rax */ -- args[0] = 5; /* %rdi */ -- args[1] = 4; /* %rsi */ -- args[2] = 1; /* %rdx */ -- args[3] = 10; /* %r10 */ -- args[4] = 8; /* %r8 */ -- args[5] = 9; /* %r9 */ -- return 0; --} -diff --git a/libebl/Makefile.am b/libebl/Makefile.am -index d0d475b8..d84e7ee2 100644 ---- a/libebl/Makefile.am -+++ b/libebl/Makefile.am -@@ -51,7 +51,7 @@ libebl_a_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \ - eblbsspltp.c eblretval.c eblreginfo.c eblnonerelocp.c \ - eblrelativerelocp.c eblsysvhashentrysize.c eblauxvinfo.c \ - eblcheckobjattr.c ebl_check_special_section.c \ -- ebl_syscall_abi.c eblabicfi.c eblstother.c eblinitreg.c \ -+ eblabicfi.c eblstother.c eblinitreg.c \ - ebldwarftoregno.c eblnormalizepc.c eblunwind.c \ - eblresolvesym.c eblcheckreloctargettype.c \ - ebl_data_marker_symbol.c -diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h -index 1e7960b8..1214bb84 100644 ---- a/libebl/ebl-hooks.h -+++ b/libebl/ebl-hooks.h -@@ -142,10 +142,6 @@ ssize_t EBLHOOK(register_info) (Ebl *ebl, - const char **prefix, const char **setname, - int *bits, int *type); - --/* Return system call ABI registers. */ --int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc, -- int *callno, int args[6]); -- - /* Disassembler function. */ - int EBLHOOK(disasm) (Ebl *ebl, const uint8_t **startp, const uint8_t *end, - GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, -diff --git a/libebl/ebl_syscall_abi.c b/libebl/ebl_syscall_abi.c -deleted file mode 100644 -index a25369d2..00000000 ---- a/libebl/ebl_syscall_abi.c -+++ /dev/null -@@ -1,40 +0,0 @@ --/* Return system call ABI mapped to DWARF register numbers. -- Copyright (C) 2008 Red Hat, Inc. -- This file is part of elfutils. -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of either -- -- * the GNU Lesser General Public License as published by the Free -- Software Foundation; either version 3 of the License, or (at -- your option) any later version -- -- or -- -- * the GNU General Public License as published by the Free -- Software Foundation; either version 2 of the License, or (at -- your option) any later version -- -- or both in parallel, as here. -- -- elfutils is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received copies of the GNU General Public License and -- the GNU Lesser General Public License along with this program. If -- not, see . */ -- --#ifdef HAVE_CONFIG_H --# include --#endif -- --#include -- -- --int --ebl_syscall_abi (Ebl *ebl, int *sp, int *pc, int *callno, int *args) --{ -- return ebl != NULL ? ebl->syscall_abi (ebl, sp, pc, callno, args) : -1; --} -diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c -index b3b6fc01..90a83f26 100644 ---- a/libebl/eblopenbackend.c -+++ b/libebl/eblopenbackend.c -@@ -214,8 +214,6 @@ static ssize_t default_register_info (Ebl *ebl, - const char **prefix, - const char **setname, - int *bits, int *type); --static int default_syscall_abi (Ebl *ebl, int *sp, int *pc, -- int *callno, int args[6]); - static bool default_check_object_attribute (Ebl *ebl, const char *vendor, - int tag, uint64_t value, - const char **tag_name, -@@ -259,7 +257,6 @@ fill_defaults (Ebl *result) - result->bss_plt_p = default_bss_plt_p; - result->return_value_location = default_return_value_location; - result->register_info = default_register_info; -- result->syscall_abi = default_syscall_abi; - result->check_object_attribute = default_check_object_attribute; - result->check_reloc_target_type = default_check_reloc_target_type; - result->disasm = NULL; -@@ -690,20 +687,6 @@ default_register_info (Ebl *ebl __attribute__ ((unused)), - return snprintf (name, namelen, "reg%d", regno); - } - --static int --default_syscall_abi (Ebl *ebl __attribute__ ((unused)), -- int *sp, int *pc, int *callno, int args[6]) --{ -- *sp = *pc = *callno = -1; -- args[0] = -1; -- args[1] = -1; -- args[2] = -1; -- args[3] = -1; -- args[4] = -1; -- args[5] = -1; -- return -1; --} -- - static bool - default_check_object_attribute (Ebl *ebl __attribute__ ((unused)), - const char *vendor __attribute__ ((unused)), -diff --git a/libebl/libebl.h b/libebl/libebl.h -index 23c0e950..731001d3 100644 ---- a/libebl/libebl.h -+++ b/libebl/libebl.h -@@ -241,14 +241,6 @@ extern ssize_t ebl_register_info (Ebl *ebl, - const char **prefix, const char **setname, - int *bits, int *type); - --/* Fill in the DWARF register numbers for the registers used in system calls. -- The SP and PC are what kernel reports call the user stack pointer and PC. -- The CALLNO and ARGS are the system call number and incoming arguments. -- Each of these is filled with the DWARF register number corresponding, -- or -1 if there is none. Returns zero when the information is available. */ --extern int ebl_syscall_abi (Ebl *ebl, int *sp, int *pc, -- int *callno, int args[6]); -- - /* Supply the ABI-specified state of DWARF CFI before CIE initial programs. - - The DWARF 3.0 spec says that the default initial states of all registers -commit 4b2edc1161e6786b09b65da3a62ef24078324d4c -Author: Mark Wielaard -Date: Mon Oct 19 10:17:59 2020 +0200 - - libdw: dwarf_frame_register takes an array of at least 3 Dwarf_Ops - - GCC11 will warn about a mismatch in the declaration of dwarf_frame_register: - - dwarf_frame_register.c:37:61: error: argument 3 of type ‘Dwarf_Op *’ - declared as a pointer [-Werror=array-parameter=] - 37 | dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem, - | ~~~~~~~~~~^~~~~~~ - libdw.h:1068:43: note: previously declared as an array ‘Dwarf_Op[3]’ - 1068 | Dwarf_Op ops_mem[3], - | ~~~~~~~~~^~~~~~~~~~ - - When fixing that it will show an actual bug in the addrcfi testcase: - - addrcfi.c:98:16: error: ‘dwarf_frame_register’ accessing 96 bytes in a - region of size 64 [-Werror=stringop-overflow=] - 98 | int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - addrcfi.c:98:16: note: referencing argument 3 of type ‘Dwarf_Op *’ - 1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno, - | ^~~~~~~~~~~~~~~~~~~~ - - Fix the declaration, fix the bug and add an extra comment to the description - in libdw.h. - - Signed-off-by: Mark Wielaard - -diff --git a/libdw/dwarf_frame_register.c b/libdw/dwarf_frame_register.c -index d0159fb8..bcf3fa03 100644 ---- a/libdw/dwarf_frame_register.c -+++ b/libdw/dwarf_frame_register.c -@@ -34,7 +34,7 @@ - #include - - int --dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem, -+dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op ops_mem[3], - Dwarf_Op **ops, size_t *nops) - { - /* Maybe there was a previous error. */ -diff --git a/libdw/libdw.h b/libdw/libdw.h -index 1a4e15a1..ad4fa6ea 100644 ---- a/libdw/libdw.h -+++ b/libdw/libdw.h -@@ -1061,9 +1061,11 @@ extern int dwarf_frame_cfa (Dwarf_Frame *frame, Dwarf_Op **ops, size_t *nops) - caller's REGNO is "same_value", i.e. this frame did not change it; - ask the caller frame where to find it. - -- For common simple expressions *OPS is OPS_MEM. For arbitrary DWARF -- expressions in the CFI, *OPS is an internal pointer that can be used as -- long as the Dwarf_CFI used to create FRAME remains alive. */ -+ For common simple expressions *OPS is OPS_MEM (which is a caller -+ owned array for for at least 3 Dwarf_Ops). For arbitrary DWARF -+ expressions in the CFI, *OPS is an internal pointer that can be -+ used as long as the Dwarf_CFI used to create FRAME remains -+ alive. */ - extern int dwarf_frame_register (Dwarf_Frame *frame, int regno, - Dwarf_Op ops_mem[3], - Dwarf_Op **ops, size_t *nops) -diff --git a/tests/addrcfi.c b/tests/addrcfi.c -index 589b8513..2b7d7bd0 100644 ---- a/tests/addrcfi.c -+++ b/tests/addrcfi.c -@@ -92,7 +92,7 @@ print_register (void *arg, - - printf ("\t%s reg%u (%s%s): ", setname, regno, prefix, regname); - -- Dwarf_Op ops_mem[2]; -+ Dwarf_Op ops_mem[3]; - Dwarf_Op *ops; - size_t nops; - int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops); diff --git a/elfutils-0.181-zstd.patch b/elfutils-0.181-zstd.patch deleted file mode 100644 index 1b68989..0000000 --- a/elfutils-0.181-zstd.patch +++ /dev/null @@ -1,348 +0,0 @@ -commit c5b0a640f0f7d2a195b822bcd88bb379476dbb97 -Author: Mark Wielaard -Date: Fri Sep 18 12:49:29 2020 +0200 - - zstd support - -diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in -index 95f63f5a..37af1b07 100644 ---- a/config/elfutils.spec.in -+++ b/config/elfutils.spec.in -@@ -24,6 +24,7 @@ BuildRequires: flex - BuildRequires: zlib-devel - BuildRequires: bzip2-devel - BuildRequires: xz-devel -+BuildRequires: libzstd-devel - - # For debuginfod - BuildRequires: pkgconfig(libmicrohttpd) >= 0.9.33 -@@ -33,6 +34,7 @@ BuildRequires: pkgconfig(libarchive) >= 3.1.2 - - # For tests need to bunzip2 test files. - BuildRequires: bzip2 -+BuildRequires: zstd - # For the run-debuginfod-find.sh test case in %check for /usr/sbin/ss - BuildRequires: iproute - BuildRequires: bsdtar -diff --git a/config/libdw.pc.in b/config/libdw.pc.in -index 3fc283db..2e83a432 100644 ---- a/config/libdw.pc.in -+++ b/config/libdw.pc.in -@@ -17,6 +17,6 @@ Requires: libelf = @VERSION@ - - # We support various compressed ELF images, but don't export any of the - # data structures or functions. zlib (gz) is always required, bzip2 (bz2) --# and lzma (xz) are optional. But bzip2 doesn't have a pkg-config file. --Requires.private: zlib @LIBLZMA@ -+# lzma (xz) and zstd () are optional. But bzip2 doesn't have a pkg-config file. -+Requires.private: zlib @LIBLZMA@ @LIBZSTD@ - Libs.private: @BZ2_LIB@ -diff --git a/configure.ac b/configure.ac -index bf833872..1b794df3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -397,8 +397,8 @@ eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip) - AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR([zlib not found but is required])]) - LIBS="$save_LIBS" - --dnl Test for bzlib and xz/lzma, gives BZLIB/LZMALIB .am --dnl conditional and config.h USE_BZLIB/USE_LZMALIB #define. -+dnl Test for bzlib and xz/lzma/zstd, gives BZLIB/LZMALIB/ZSTD .am -+dnl conditional and config.h USE_BZLIB/USE_LZMALIB/USE_ZSTD #define. - save_LIBS="$LIBS" - LIBS= - eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2) -@@ -408,6 +408,9 @@ AC_SUBST([BZ2_LIB]) - eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)]) - AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""]) - AC_SUBST([LIBLZMA]) -+eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)]) -+AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""]) -+AC_SUBST([LIBZSTD]) - zip_LIBS="$LIBS" - LIBS="$save_LIBS" - AC_SUBST([zip_LIBS]) -@@ -677,6 +680,10 @@ if test "$HAVE_BUNZIP2" = "no"; then - AC_MSG_WARN([No bunzip2, needed to run make check]) - fi - -+# For tests that need to use zstd compression -+AC_CHECK_PROG(HAVE_ZSTD, zstd, yes, no) -+AM_CONDITIONAL([HAVE_ZSTD],[test "x$HAVE_ZSTD" = "xyes"]) -+ - # Look for libcurl for libdebuginfod minimum version as per rhel7. - AC_ARG_ENABLE([libdebuginfod],AC_HELP_STRING([--enable-libdebuginfod], [Build debuginfod client library (can be =dummy)])) - AS_IF([test "x$enable_libdebuginfod" != "xno"], [ -@@ -742,6 +749,7 @@ AC_MSG_NOTICE([ - gzip support : ${with_zlib} - bzip2 support : ${with_bzlib} - lzma/xz support : ${with_lzma} -+ zstd support : ${with_zstd} - libstdc++ demangle support : ${enable_demangler} - File textrel check : ${enable_textrelcheck} - Symbol versioning : ${enable_symbol_versioning} -@@ -759,6 +767,7 @@ AC_MSG_NOTICE([ - - EXTRA TEST FEATURES (used with make check) - have bunzip2 installed (required) : ${HAVE_BUNZIP2} -+ have zstd installed : ${HAVE_ZSTD} - debug branch prediction : ${use_debugpred} - gprof support : ${use_gprof} - gcov support : ${use_gcov} -diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am -index 1de05492..a0013e41 100644 ---- a/libdwfl/Makefile.am -+++ b/libdwfl/Makefile.am -@@ -78,6 +78,9 @@ endif - if LZMA - libdwfl_a_SOURCES += lzma.c - endif -+if ZSTD -+libdwfl_a_SOURCES += zstd.c -+endif - if LIBDEBUGINFOD - libdwfl_a_SOURCES += debuginfod-client.c - endif -diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c -index e9988cc2..ba8ecfba 100644 ---- a/libdwfl/gzip.c -+++ b/libdwfl/gzip.c -@@ -48,6 +48,12 @@ - # define inflateInit(z) lzma_auto_decoder (z, 1 << 30, 0) - # define do_inflate(z) lzma_code (z, LZMA_RUN) - # define inflateEnd(z) lzma_end (z) -+#elif defined ZSTD -+# define USE_INFLATE 1 -+# include -+# define unzip __libdw_unzstd -+# define DWFL_E_ZLIB DWFL_E_ZSTD -+# define MAGIC "\x28\xb5\x2f\xfd" - #elif defined BZLIB - # define USE_INFLATE 1 - # include -@@ -119,6 +125,7 @@ fail (struct unzip_state *state, Dwfl_Error failure) - return failure; - } - -+#ifndef ZSTD - static inline Dwfl_Error - zlib_fail (struct unzip_state *state, int result) - { -@@ -132,6 +139,7 @@ zlib_fail (struct unzip_state *state, int result) - return fail (state, DWFL_E_ZLIB); - } - } -+#endif - - #if !USE_INFLATE - static Dwfl_Error -@@ -197,7 +205,7 @@ unzip (int fd, off_t start_offset, - - ssize_t n = pread_retry (fd, state.input_buffer, READ_SIZE, start_offset); - if (unlikely (n < 0)) -- return zlib_fail (&state, Z (ERRNO)); -+ return fail (&state, DWFL_E_ERRNO); - - state.input_pos = n; - mapped = state.input_buffer; -@@ -223,7 +231,74 @@ unzip (int fd, off_t start_offset, - /* Not a compressed file. */ - return DWFL_E_BADELF; - --#if USE_INFLATE -+#ifdef ZSTD -+ /* special case for libzstd since it is slightly different from the -+ API provided by bzlib and liblzma. */ -+ -+ void *next_in = mapped; -+ size_t avail_in = state.mapped_size; -+ void *next_out = NULL; -+ size_t avail_out = 0; -+ size_t total_out = 0; -+ -+ size_t result; -+ ZSTD_DCtx *dctx = ZSTD_createDCtx(); -+ if (dctx == NULL) -+ return fail (&state, DWFL_E_NOMEM); -+ -+ do -+ { -+ if (avail_in == 0 && state.input_buffer != NULL) -+ { -+ ssize_t n = pread_retry (fd, state.input_buffer, READ_SIZE, -+ start_offset + state.input_pos); -+ if (unlikely (n < 0)) -+ { -+ ZSTD_freeDCtx (dctx); -+ return fail (&state, DWFL_E_ERRNO); -+ } -+ next_in = state.input_buffer; -+ avail_in = n; -+ state.input_pos += n; -+ } -+ if (avail_out == 0) -+ { -+ ptrdiff_t pos = (void *) next_out - state.buffer; -+ if (!bigger_buffer (&state, avail_in)) -+ { -+ ZSTD_freeDCtx (dctx); -+ return fail (&state, DWFL_E_NOMEM); -+ } -+ next_out = state.buffer + pos; -+ avail_out = state.size - pos; -+ } -+ -+ ZSTD_inBuffer input = { next_in, avail_in, 0 }; -+ ZSTD_outBuffer output = { next_out, avail_out, 0 }; -+ result = ZSTD_decompressStream (dctx, &output, &input); -+ -+ if (! ZSTD_isError (result)) -+ { -+ total_out += output.pos; -+ next_out += output.pos; -+ avail_out -= output.pos; -+ next_in += input.pos; -+ avail_in -= input.pos; -+ } -+ -+ if (result == 0) -+ break; -+ } -+ while (avail_in > 0 && ! ZSTD_isError (result)); -+ -+ ZSTD_freeDCtx (dctx); -+ -+ if (ZSTD_isError (result)) -+ return fail (&state, DWFL_E_ZSTD); -+ -+ smaller_buffer (&state, total_out); -+ -+#elif USE_INFLATE - - /* This style actually only works with bzlib and liblzma. - The stupid zlib interface has nothing to grok the -diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h -index ad6779ad..4c6fcb28 100644 ---- a/libdwfl/libdwflP.h -+++ b/libdwfl/libdwflP.h -@@ -61,6 +61,7 @@ typedef struct Dwfl_Process Dwfl_Process; - DWFL_ERROR (ZLIB, N_("gzip decompression failed")) \ - DWFL_ERROR (BZLIB, N_("bzip2 decompression failed")) \ - DWFL_ERROR (LZMA, N_("LZMA decompression failed")) \ -+ DWFL_ERROR (ZSTD, N_("zstd decompression failed")) \ - DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \ - DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \ - DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \ -@@ -612,6 +613,10 @@ extern Dwfl_Error __libdw_unlzma (int fd, off_t start_offset, - void *mapped, size_t mapped_size, - void **whole, size_t *whole_size) - internal_function; -+extern Dwfl_Error __libdw_unzstd (int fd, off_t start_offset, -+ void *mapped, size_t mapped_size, -+ void **whole, size_t *whole_size) -+ internal_function; - - /* Skip the image header before a file image: updates *START_OFFSET. */ - extern Dwfl_Error __libdw_image_header (int fd, off_t *start_offset, -diff --git a/libdwfl/open.c b/libdwfl/open.c -index 35fc5283..77bd2bd9 100644 ---- a/libdwfl/open.c -+++ b/libdwfl/open.c -@@ -44,6 +44,10 @@ - # define __libdw_unlzma(...) DWFL_E_BADELF - #endif - -+#if !USE_ZSTD -+# define __libdw_unzstd(...) DWFL_E_BADELF -+#endif -+ - /* Consumes and replaces *ELF only on success. */ - static Dwfl_Error - decompress (int fd __attribute__ ((unused)), Elf **elf) -@@ -64,6 +68,8 @@ decompress (int fd __attribute__ ((unused)), Elf **elf) - error = __libdw_bunzip2 (fd, offset, mapped, mapped_size, &buffer, &size); - if (error == DWFL_E_BADELF) - error = __libdw_unlzma (fd, offset, mapped, mapped_size, &buffer, &size); -+ if (error == DWFL_E_BADELF) -+ error = __libdw_unzstd (fd, offset, mapped, mapped_size, &buffer, &size); - - if (error == DWFL_E_NOERROR) - { -diff --git a/libdwfl/zstd.c b/libdwfl/zstd.c -new file mode 100644 -index 00000000..dc4d5238 ---- /dev/null -+++ b/libdwfl/zstd.c -@@ -0,0 +1,4 @@ -+/* libzstd is pretty close to zlib and bzlib. */ -+ -+#define ZSTD -+#include "gzip.c" -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 4629ce64..9d0707da 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -204,6 +204,10 @@ if LZMA - TESTS += run-readelf-s.sh run-dwflsyms.sh - endif - -+if HAVE_ZSTD -+TESTS += run-readelf-compressed-zstd.sh -+endif -+ - if HAVE_LIBASM - check_PROGRAMS += $(asm_TESTS) - TESTS += $(asm_TESTS) run-disasm-bpf.sh -@@ -256,6 +260,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ - run-nm-syms.sh testfilesyms32.bz2 testfilesyms64.bz2 \ - run-nm-self.sh run-readelf-self.sh run-readelf-info-plus.sh \ - run-readelf-compressed.sh \ -+ run-readelf-compressed-zstd.sh \ - run-readelf-const-values.sh testfile-const-values.debug.bz2 \ - run-addrcfi.sh run-dwarfcfi.sh \ - testfile11-debugframe.bz2 testfile12-debugframe.bz2 \ -diff --git a/tests/run-readelf-compressed-zstd.sh b/tests/run-readelf-compressed-zstd.sh -new file mode 100755 -index 00000000..96208092 ---- /dev/null -+++ b/tests/run-readelf-compressed-zstd.sh -@@ -0,0 +1,39 @@ -+#! /bin/sh -+# Copyright (C) 2018 Red Hat, Inc. -+# This file is part of elfutils. -+# -+# This file is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# elfutils is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. $srcdir/test-subr.sh -+ -+if ! grep -q -F '#define USE_ZSTD' ${abs_top_builddir}/config.h; then -+ echo "elfutils built without zstd support" -+ exit 77 -+fi -+ -+# See run-strip-reloc.sh -+testfiles hello_i386.ko -+ -+tempfiles hello_i386.ko.zst readelf.out.1 readelf.out.2 -+ -+testrun ${abs_top_builddir}/src/readelf -a hello_i386.ko > readelf.out.1 -+zstd hello_i386.ko -+testrun ${abs_top_builddir}/src/readelf -a hello_i386.ko.zst > readelf.out.2 -+ -+diff -u readelf.out.1 readelf.out.2 -+if [ $? != 0 ]; then -+ exit 1; -+fi -+ -+exit 0 diff --git a/elfutils.spec b/elfutils.spec index 0ad6e76..21264cb 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils -Version: 0.181 -%global baserelease 3 +Version: 0.182 +%global baserelease 1 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -60,8 +60,6 @@ BuildRequires: autoconf %endif # Patches -Patch1: elfutils-0.181-zstd.patch -Patch2: elfutils-0.181-array-param.patch %description Elfutils is a collection of utilities, including stack (to show @@ -253,8 +251,6 @@ such servers to download those files on demand. %setup -q # Apply patches -%patch1 -p1 -b .zstd -%patch2 -p1 -b .array_param autoreconf -f -v -i @@ -291,6 +287,10 @@ rm -rf ${RPM_BUILD_ROOT} chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* +# We don't have standard DEBUGINFOD_URLS yet. +rm ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d/debuginfod.sh +rm ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d/debuginfod.csh + %find_lang %{name} %if %{provide_yama_scope} @@ -420,12 +420,13 @@ fi %files debuginfod %defattr(-,root,root) %{_bindir}/debuginfod -%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/debuginfod +%config(noreplace) %{_sysconfdir}/sysconfig/debuginfod %{_unitdir}/debuginfod.service +%{_sysconfdir}/sysconfig/debuginfod %{_mandir}/man8/debuginfod.8* %dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod -%verify(not md5 size mtime) %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite +%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite %pre debuginfod getent group debuginfod >/dev/null || groupadd -r debuginfod @@ -441,6 +442,16 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Sat Oct 31 2020 Mark Wielaard - 0.182-1 +- Upgrade to upstream 0.182 + - backends: Support for tilegx has been removed. + - config: New /etc/profile.d files to provide default $DEBUGINFOD_URLS. + - debuginfod: More efficient package traversal, tolerate various + errors during scanning, grooming progress is more visible and + interruptible, more prometheus metrics. + - debuginfod-client: Now supports compressed (kernel) ELF images. + - libdwfl: Add ZSTD compression support. + * Mon Oct 19 2020 Mark Wielaard - 0.181-3 - Add elfutils-0.181-array-param.patch. diff --git a/sources b/sources index b0e26f0..8697cd9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (elfutils-0.181.tar.bz2) = d565541d5817f409dc89ebb1ee593366f69c371a1531308eeb67ff934b14a0fab0c9009fd7c23240efbaa1b4e04edac5c425e47d80e3e66ba03dcaf000afea36 +SHA512 (elfutils-0.182.tar.bz2) = 8ab0735bbe11b4383169341bf674ace360038b6ae5239f1d5a991c46260cd4bce545e078735b7de3b8fab132bb5da41f60689ff1b1d7ebccfada117a954a2c81