diff --git a/0001-testsuite-Handle-readelf-following-links-by-default.patch b/0001-testsuite-Handle-readelf-following-links-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0514e801fc6c810f9335adb56b221c92933d809 --- /dev/null +++ b/0001-testsuite-Handle-readelf-following-links-by-default.patch @@ -0,0 +1,57 @@ +From b1f26dc76158e1f3364836d8b540b17a7a1ccb3d Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sat, 20 Mar 2021 09:37:31 +0100 +Subject: [PATCH] [testsuite] Handle readelf following links by default + +Since binutils commit c46b706620e "Change the readelf and objdump programs so +that they will automatically follow links to separate debug info files" there +are a few FAILs in the dwz testsuite. + +This is just due to changing the default behaviour for readelf. + +Fix this by testing whether the new -Wn readelf flag is supported, +and if so, adding it to the readelf call. + +2021-03-20 Tom de Vries + + PR dwz/27592 + * testsuite/dwz.tests/odr-struct-multifile.sh: Call readelf with -wN + if supported. +--- + testsuite/dwz.tests/odr-struct-multifile.sh | 9 +++++++-- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh +index cc462c9..20b682b 100644 +--- a/testsuite/dwz.tests/odr-struct-multifile.sh ++++ b/testsuite/dwz.tests/odr-struct-multifile.sh +@@ -2,6 +2,11 @@ if ! $execs/dwz-for-test --odr -v 2>/dev/null; then + exit 77 + fi + ++readelf_flags="" ++if readelf -h 2>&1 | grep -q "\-wN"; then ++ readelf_flags=-wN ++fi ++ + cp $execs/odr-struct 1 + cp 1 2 + +@@ -41,12 +46,12 @@ done + + + for name in aaa bbb ccc; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) ++ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true) + [ $cnt -eq 0 ] + done + + for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) ++ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true) + [ $cnt -eq 0 ] + done + +-- +2.19.1.6.gb485710b + diff --git a/dwz-0.14.tar.xz b/dwz-0.14.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..3d6789fa0c184db8bf86243f17c6702be4a6637a Binary files /dev/null and b/dwz-0.14.tar.xz differ diff --git a/dwz.spec b/dwz.spec new file mode 100644 index 0000000000000000000000000000000000000000..493d7f72200a5f6b170a3ba9955eb7b5eeb613ff --- /dev/null +++ b/dwz.spec @@ -0,0 +1,45 @@ +%define anolis_release 1 +Summary: DWARF optimization and duplicate removal tool +Name: dwz +Url: https://sourceware.org/dwz/ +Version: 0.14 +Release: %{anolis_release}%{?dist} +License: GPLv2+ and GPLv3+ +Source: https://sourceware.org/ftp/dwz/releases/%{name}-%{version}.tar.xz +# backport from upstream to fix odr-struct-multifile.sh fained +Patch1: 0001-testsuite-Handle-readelf-following-links-by-default.patch +BuildRequires: gcc, gcc-c++, gdb, elfutils-libelf-devel, dejagnu +BuildRequires: make + +%description +The dwz package contains a program that attempts to optimize DWARF +debugging information contained in ELF shared libraries and ELF executables +for size, by replacing DWARF information representation with equivalent +smaller representation where possible and by reducing the amount of +duplication using techniques from DWARF standard appendix E - creating +DW_TAG_partial_unit compilation units (CUs) for duplicated information +and using DW_TAG_imported_unit to import it into each CU that needs it. + +%prep +%autosetup -p1 -n dwz + +%build +%make_build CFLAGS='%{optflags}' LDFLAGS='%{build_ldflags}' \ + prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir} + +%install +rm -rf %{buildroot} +%make_install prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir} + +%check +make check + +%files +%license COPYING COPYING3 COPYING.RUNTIME +%{_bindir}/dwz +%{_mandir}/man1/dwz.1* + +%changelog +* Mon Apr 18 2022 Chunmei Xu - 0.14-1 +- init from upstream +- fix failed test:odr-struct-multifile.sh