diff --git a/.elfutils.metadata b/.elfutils.metadata index 33bb06f..ff980b9 100644 --- a/.elfutils.metadata +++ b/.elfutils.metadata @@ -1 +1 @@ -00b678e1182c331ea75af982d666bbc38ef8b055 SOURCES/elfutils-0.166.tar.bz2 +53e486ddba572cf872d32e9aad4d7d7aa6e767ff SOURCES/elfutils-0.168.tar.bz2 diff --git a/.gitignore b/.gitignore index 860bb9a..861874f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/elfutils-0.166.tar.bz2 +SOURCES/elfutils-0.168.tar.bz2 diff --git a/SOURCES/elfutils-0.166-elfcmp-comp-gcc6.patch b/SOURCES/elfutils-0.166-elfcmp-comp-gcc6.patch deleted file mode 100644 index 2183b35..0000000 --- a/SOURCES/elfutils-0.166-elfcmp-comp-gcc6.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 836a16fe5b5bab4a3afe2c991c104652775ce3a3 Mon Sep 17 00:00:00 2001 -From: David Abdurachmanov -Date: Mon, 11 Apr 2016 16:00:57 +0200 -Subject: [PATCH] elfcmp: fix self-comparison error with GCC 6 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Noticed with Fedora 24 Alpha, gcc (GCC) 6.0.0 20160406 -(Red Hat 6.0.0-0.20). - -elfcmp.c: In function ‘main’: -elfcmp.c:364:199: error: self-comparison always evaluates -to false [-Werror=tautological-compare] - if (unlikely (name1 == NULL || name2 == NULL - -Signed-off-by: David Abdurachmanov ---- - src/ChangeLog | 4 ++++ - src/elfcmp.c | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/ChangeLog b/src/ChangeLog -index f74b5dc..bdc9d13 100644 ---- a/src/ChangeLog -+++ b/src/ChangeLog -@@ -1,3 +1,7 @@ -+2016-04-11 David Abdurachmanov -+ -+ * elfcmp.c (main): Fix self-comparison error with GCC 6. -+ - 2016-03-21 Mark Wielaard - - * nm.c (show_symbols): Check for malloc size argument overflow. -diff --git a/src/elfcmp.c b/src/elfcmp.c -index 852b92f..7b5d39c 100644 ---- a/src/elfcmp.c -+++ b/src/elfcmp.c -@@ -368,7 +368,7 @@ main (int argc, char *argv[]) - && sym1->st_shndx != SHN_UNDEF) - || sym1->st_info != sym2->st_info - || sym1->st_other != sym2->st_other -- || sym1->st_shndx != sym1->st_shndx)) -+ || sym1->st_shndx != sym2->st_shndx)) - { - // XXX Do we want to allow reordered symbol tables? - symtab_mismatch: --- -1.8.3.1 - diff --git a/SOURCES/elfutils-0.168-libasm-truncation.patch b/SOURCES/elfutils-0.168-libasm-truncation.patch new file mode 100644 index 0000000..f6429a5 --- /dev/null +++ b/SOURCES/elfutils-0.168-libasm-truncation.patch @@ -0,0 +1,37 @@ +commit 9e977aca87678417184f01d02c92b2ecb15727e3 +Author: Mark Wielaard +Date: Sun Feb 12 21:51:34 2017 +0100 + + libasm: Fix GCC7 one -Wformat-truncation=2 warning. + + Make sure that if we have really many labels the tempsym doesn't get + truncated because it is too small to hold the whole name. + + This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed + out by enabling this warning because there are currently some issues + with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 + + Signed-off-by: Mark Wielaard + +diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c +index 332432a..5389166 100644 +--- a/libasm/asm_newsym.c ++++ b/libasm/asm_newsym.c +@@ -1,5 +1,5 @@ + /* Define new symbol for current position in given section. +- Copyright (C) 2002, 2005, 2016 Red Hat, Inc. ++ Copyright (C) 2002, 2005, 2016, 2017 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 2002. + +@@ -44,7 +44,9 @@ AsmSym_t * + asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, + int type, int binding) + { +-#define TEMPSYMLEN 10 ++/* We don't really expect labels with many digits, but in theory it could ++ be 10 digits (plus ".L" and a zero terminator). */ ++#define TEMPSYMLEN 13 + char tempsym[TEMPSYMLEN]; + AsmSym_t *result; + diff --git a/SOURCES/elfutils-0.168-ppc64-attrs.patch b/SOURCES/elfutils-0.168-ppc64-attrs.patch new file mode 100644 index 0000000..06f8cef --- /dev/null +++ b/SOURCES/elfutils-0.168-ppc64-attrs.patch @@ -0,0 +1,39 @@ +From 817bd9376dd01039a30dfc4cf9dddd8cdd247446 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 15 Feb 2017 14:30:27 +0100 +Subject: [PATCH] backends: Add support for EM_PPC64 GNU_ATTRIBUTES. + +ppc64 and ppc64le ELF files can also contain a power specific +.gnu.attributes section. Add support for those and recognize the new +GNU_Power_ABI_FP Single-precision hard float value. + +Signed-off-by: Mark Wielaard +--- +diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c +index 2ba8232..11d3a77 100644 +--- a/backends/ppc64_init.c ++++ b/backends/ppc64_init.c +@@ -67,6 +67,7 @@ ppc64_init (Elf *elf __attribute__ ((unused)), + HOOK (eh, syscall_abi); + HOOK (eh, core_note); + HOOK (eh, auxv_info); ++ HOOK (eh, check_object_attribute); + HOOK (eh, abi_cfi); + /* gcc/config/ #define DWARF_FRAME_REGISTERS. */ + eh->frame_nregs = (114 - 1) + 32; +diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c +index 612c576..48d7129 100644 +--- a/backends/ppc_attrs.c ++++ b/backends/ppc_attrs.c +@@ -51,6 +51,7 @@ ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)), + "Hard or soft float", + "Hard float", + "Soft float", ++ "Single-precision hard float", + }; + if (value < sizeof fp_kinds / sizeof fp_kinds[0]) + *value_name = fp_kinds[value]; + +-- +1.8.3.1 + diff --git a/SOURCES/elfutils-0.168-ppc64-fallback-unwinder.patch b/SOURCES/elfutils-0.168-ppc64-fallback-unwinder.patch new file mode 100644 index 0000000..e75861b --- /dev/null +++ b/SOURCES/elfutils-0.168-ppc64-fallback-unwinder.patch @@ -0,0 +1,172 @@ +From 1b2cd3f4dc581eed0fc1ee98f97aa492a19873b0 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 21 May 2017 23:33:15 +0200 +Subject: [PATCH] ppc64: Add minimal fallback unwinder. + +This adds a minimal fallback unwinder for ppc64[le] in case we cannot find +CFI for a particular address. It simply always sets the program counter to +the link register, picks the previous stack pointer from the backchain, +and the previous link register from the LR save area. + +This is enough for some simple situations when we don't have CFI and +seems to work nicely in the case of perf with libdw powerpc support: +https://lkml.org/lkml/2017/5/18/998 + +Signed-off-by: Mark Wielaard +--- + + backends/Makefile.am | 2 +- + backends/ppc64_init.c | 1 + + backends/ppc64_unwind.c | 76 +++++++++++++++++++++++++++++++++ + +diff --git a/backends/Makefile.am b/backends/Makefile.am +index ff80a82..ac45a45 100644 +--- a/backends/Makefile.am ++++ b/backends/Makefile.am +@@ -98,7 +98,7 @@ am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) + + ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ +- ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c ++ ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c + libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) + am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) + +diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c +index 11d3a77..e567033 100644 +--- a/backends/ppc64_init.c ++++ b/backends/ppc64_init.c +@@ -73,6 +73,7 @@ ppc64_init (Elf *elf __attribute__ ((unused)), + eh->frame_nregs = (114 - 1) + 32; + HOOK (eh, set_initial_registers_tid); + HOOK (eh, dwarf_to_regno); ++ HOOK (eh, unwind); + HOOK (eh, resolve_sym_value); + + /* Find the function descriptor .opd table for resolve_sym_value. */ +diff --git a/backends/ppc64_unwind.c b/backends/ppc64_unwind.c +new file mode 100644 +index 0000000..4fa0b5a +--- /dev/null ++++ b/backends/ppc64_unwind.c +@@ -0,0 +1,76 @@ ++/* Get previous frame state for an existing frame state. ++ Copyright (C) 2017 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 ppc64_ ++ ++#define LR_REG 65 /* Not 108, see ppc_dwarf_to_regno. */ ++#define SP_REG 1 ++ ++#define LR_OFFSET 16 ++ ++#include "libebl_CPU.h" ++ ++/* Simplistic fallback frame unwinder. SP points to the backchain (contains ++ address of previous stack pointer). At SP offset 16 is the LR save area ++ (contains the value of the previous LR). */ ++ ++bool ++EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)), ++ Dwarf_Addr pc __attribute__ ((unused)), ++ ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc, ++ ebl_pid_memory_read_t *readfunc, void *arg, ++ bool *signal_framep __attribute__ ((unused))) ++{ ++ Dwarf_Word sp, newSp, lr, newLr; ++ ++ /* Stack pointer points to the backchain which contains the previous sp. */ ++ if (! getfunc (SP_REG, 1, &sp, arg)) ++ sp = 0; ++ ++ /* Link register contains previous program counter. */ ++ if (! getfunc (LR_REG, 1, &lr, arg) ++ || lr == 0 ++ || ! setfunc (-1, 1, &lr, arg)) ++ return false; ++ ++ if (! readfunc(sp, &newSp, arg)) ++ newSp = 0; ++ ++ if (! readfunc(newSp + LR_OFFSET, &newLr, arg)) ++ newLr = 0; ++ ++ setfunc(SP_REG, 1, &newSp, arg); ++ setfunc(LR_REG, 1, &newLr, arg); ++ ++ /* Sanity check the stack grows down. */ ++ return newSp > sp; ++} + +diff -ur elfutils-0.168.orig/backends/Makefile.in elfutils-0.168/backends/Makefile.in +--- elfutils-0.168.orig/backends/Makefile.in 2017-05-30 22:35:20.251108585 +0200 ++++ elfutils-0.168/backends/Makefile.in 2017-05-30 22:36:43.622531949 +0200 +@@ -158,7 +158,7 @@ + ppc64_retval.$(OBJEXT) ppc64_corenote.$(OBJEXT) \ + ppc_regs.$(OBJEXT) ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) \ + ppc_syscall.$(OBJEXT) ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) \ +- ppc64_resolve_sym.$(OBJEXT) ++ ppc64_unwind.$(OBJEXT) ppc64_resolve_sym.$(OBJEXT) + libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) + libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) + libebl_ppc_pic_a_LIBADD = +@@ -503,7 +503,7 @@ + am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) + ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ +- ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c ++ ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c + + libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) + am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) +@@ -692,6 +692,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_resolve_sym.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_retval.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_symbol.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_unwind.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_attrs.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_auxv.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_cfi.Po@am__quote@ + +-- +1.8.3.1 +--- elfutils-0.168/tests/backtrace-subr.sh.orig 2017-05-31 00:39:02.797260621 +0200 ++++ elfutils-0.168/tests/backtrace-subr.sh 2017-05-31 00:39:28.445782296 +0200 +@@ -46,7 +46,7 @@ + # Ignore it here as it is a bug of OS, not a bug of elfutils. + check_err() + { +- if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range)$' \ ++ if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range|Invalid register|\(null\))$' \ + | wc -c) \ + -eq 0 ] + then diff --git a/SPECS/elfutils.spec b/SPECS/elfutils.spec index 55b2c6f..10a3cdf 100644 --- a/SPECS/elfutils.spec +++ b/SPECS/elfutils.spec @@ -1,15 +1,15 @@ Name: elfutils -Summary: A collection of utilities and DSOs to handle compiled objects -Version: 0.166 -%global baserelease 2 -URL: https://fedorahosted.org/elfutils/ -%global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ +Summary: A collection of utilities and DSOs to handle ELF files and DWARF data +Version: 0.168 +%global baserelease 8 +URL: http://elfutils.org/ +%global source_url ftp://sourceware.org/pub/elfutils/%{version}/ License: GPLv3+ and (GPLv2+ or LGPLv3+) Group: Development/Tools Release: %{baserelease}%{?dist} -%global provide_yama_scope 0 +%global provide_yama_scope 1 %if 0%{?fedora} %global provide_yama_scope (%fedora >= 22) @@ -20,7 +20,9 @@ Release: %{baserelease}%{?dist} Source: %{?source_url}%{name}-%{version}.tar.bz2 # Patches -Patch1: elfutils-0.166-elfcmp-comp-gcc6.patch +Patch1: elfutils-0.168-libasm-truncation.patch +Patch2: elfutils-0.168-ppc64-attrs.patch +Patch3: elfutils-0.168-ppc64-fallback-unwinder.patch Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libs%{depsuffix} = %{version}-%{release} @@ -38,6 +40,13 @@ BuildRequires: xz-devel %global _gnu %{nil} %global _program_prefix eu- +# The lib[64]/elfutils directory contains the private ebl backend +# libraries. They must not be exposed as global provides. We don't +# need to filter the requires since they are only loaded with dlopen. +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%global __provides_exclude ^libebl_.*\\.so.*$ +%endif + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -164,7 +173,9 @@ profiling) of processes. %setup -q # Apply patches -%patch1 -p1 -b .elfcmp_gcc6 +%patch1 -p1 -b .trunc +%patch2 -p1 -b .attr +%patch3 -p1 -b .unwind_ppc64 find . -name \*.sh ! -perm -0100 -print | xargs chmod +x @@ -189,11 +200,6 @@ make -s install DESTDIR=${RPM_BUILD_ROOT} chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.so* -# XXX Nuke unpackaged files -(cd ${RPM_BUILD_ROOT} - rm -f .%{_bindir}/eu-ld -) - %find_lang %{name} %if %{provide_yama_scope} @@ -237,7 +243,6 @@ rm -rf ${RPM_BUILD_ROOT} %{_bindir}/eu-stack %{_bindir}/eu-strings %{_bindir}/eu-strip -#%%{_bindir}/eu-ld %{_bindir}/eu-unstrip %{_bindir}/eu-make-debug-archive %{_bindir}/eu-elfcompress @@ -301,6 +306,18 @@ rm -rf ${RPM_BUILD_ROOT} %endif %changelog +* Tue May 30 2017 Mark Wielaard - 0.168-8 +- Fix ppc64 fallback unwinder (#1454754) + +* Thu May 25 2017 Mark Wielaard - 0.168-7 +- Enable default-yama-scope (#1455514) + +* Mon May 22 2017 Mark Wielaard - 0.168-6 +- Add ppc64 fallback unwinder (#1454754) + +* Wed Mar 1 2017 Mark Wielaard - 0.168-5 +- Rebase to fedora elfutils 0.168 (#1371517, #1400302) + * Thu Apr 14 2016 Mark Wielaard - 0.166-2 - Rebase to fedora elfutils 0.166 (#1296313, #1304873)