From 1b050b058d4642e62541d64549f0bc8ab006af705414041072cfe709e3bb305f Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 20 Dec 2024 08:15:41 +0000 Subject: [PATCH 1/3] - Use %{SOURCE2} macro instead of hardcoding the source file name/path. This makes the spec file compatible with rpmbuild. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=50 --- .gitattributes | 23 ++ .gitignore | 1 + _multibuild | 3 + dwz-0.15.tar.xz | 3 + dwz-enable-odr-by-default.patch | 35 +++ dwz-remove-odr-struct-multifile.sh.patch | 67 ++++++ dwz-rpmlintrc | 25 ++ dwz.changes | 277 +++++++++++++++++++++++ dwz.spec | 153 +++++++++++++ tramp3d-v4.cpp.xz | 3 + 10 files changed, 590 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 dwz-0.15.tar.xz create mode 100644 dwz-enable-odr-by-default.patch create mode 100644 dwz-remove-odr-struct-multifile.sh.patch create mode 100644 dwz-rpmlintrc create mode 100644 dwz.changes create mode 100644 dwz.spec create mode 100644 tramp3d-v4.cpp.xz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..964176c --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + testsuite + diff --git a/dwz-0.15.tar.xz b/dwz-0.15.tar.xz new file mode 100644 index 0000000..3100349 --- /dev/null +++ b/dwz-0.15.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3845310e34e306747207e1038bbc4085c7e2edff8de20f7ca7f3884ca752e4 +size 150080 diff --git a/dwz-enable-odr-by-default.patch b/dwz-enable-odr-by-default.patch new file mode 100644 index 0000000..aafcd37 --- /dev/null +++ b/dwz-enable-odr-by-default.patch @@ -0,0 +1,35 @@ +diff --git a/args.c b/args.c +index e93c24d..3e1113f 100644 +--- a/args.c ++++ b/args.c +@@ -66,7 +66,7 @@ int gen_cu_p = 0; + + enum die_count_methods die_count_method = estimate; + +-int odr = 0; ++int odr = 1; + enum odr_mode odr_mode = ODR_LINK; + + /* Filename if inter-file size optimization should be performed. */ +@@ -202,7 +202,7 @@ static struct option_help dwz_common_options_help[] = + "Don't optimize files larger than this limit." }, + { NULL, "odr", NULL, NULL, + NULL }, +- { NULL, "no-odr", NULL, "Disabled", ++ { NULL, "no-odr", NULL, "Enabled", + "Enable/disable one definition rule optimization." }, + { NULL, "odr-mode", "", "link", + "Set aggressiveness level of one definition rule optimization." }, +diff --git a/dwz.1 b/dwz.1 +index 1cff329..f3cd3dd 100644 +--- a/dwz.1 ++++ b/dwz.1 +@@ -133,7 +133,7 @@ considered equal. This has the effect that DIEs referring to distinct DIEs + representing the same type (like f.i. pointer type DIEs) are considered equal, + and may be deduplicated. The status of this optimization is experimental. + It's disabled in low-mem mode. +-Disabled by default. ++Enabled by default. + .TP + .B \-\-odr-mode= + Set the One-Definition-Rule optimization aggressiveness: basic or link. diff --git a/dwz-remove-odr-struct-multifile.sh.patch b/dwz-remove-odr-struct-multifile.sh.patch new file mode 100644 index 0000000..705fab4 --- /dev/null +++ b/dwz-remove-odr-struct-multifile.sh.patch @@ -0,0 +1,67 @@ +diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh +deleted file mode 100755 +index 5961abf..0000000 +--- a/testsuite/dwz.tests/odr-struct-multifile.sh ++++ /dev/null +@@ -1,61 +0,0 @@ +-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 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 2 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- case $name in +- member_one|member_two) +- [ $cnt -eq 2 ] +- ;; +- member_three|member_four) +- [ $cnt -eq 1 ] +- ;; +- esac +-done +- +-decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true) +- +-$execs/dwz-for-test --odr 1 2 -m 3 +- +-verify-dwarf.sh 1 +-verify-dwarf.sh 3 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-# Even with -wN readelf 2.38-15.fc37 follows and prints the contents +-# of the alt file. So make sure it cannot do that by removing it. +-rm 3 +- +-for name in aaa bbb ccc; do +- 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 $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 0 ] +-done +- +-rm -f 1 2 3 diff --git a/dwz-rpmlintrc b/dwz-rpmlintrc new file mode 100644 index 0000000..d65bb5d --- /dev/null +++ b/dwz-rpmlintrc @@ -0,0 +1,25 @@ +# The package should _not_ be noarch, testresults differ from architecture +# to architecture. +addFilter("dwz-testsuite.* no-binary") + +# The rpmlint warning is: +# dwz-testsuite.nosrc: W: invalid-spec-name +# The spec file name (without the .spec suffix) must match the package name +# ("Name:" tag). Either rename your package or the specfile. +# This seems to be a multibuild artifact. The package name is dwz-testsuite, +# but the specfile filename is dwz.spec. The only way we can fix this is by +# reverting to a two-specfile setup. +# +# FTR, the warning comes paired with these grep failures in the "Preparing +# packages log": +# ... testing for empty debuginfo packages +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# ... running 50-check-filelist +# ... +# ... testing devel dependencies required by libtool .la files +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# (can be skipped by "skip-check-libtool-deps" anywhere in spec) +# ... running 50-check-packaged-twice +# +# So, skip the rpmlint warning. This doesn't fix the grep fails. +addFilter("dwz-testsuite.* invalid-spec-name") diff --git a/dwz.changes b/dwz.changes new file mode 100644 index 0000000..1dc9b45 --- /dev/null +++ b/dwz.changes @@ -0,0 +1,277 @@ +------------------------------------------------------------------- +Fri Dec 20 07:47:14 UTC 2024 - Martin Hauke + +- Use %{SOURCE2} macro instead of hardcoding the source file name/path. + This makes the spec file compatible with rpmbuild. + +------------------------------------------------------------------- +Mon Feb 26 08:07:43 UTC 2024 - Dominique Leuenberger + +- Use %autosetup macro. Allows to eliminate the usage of deprecated + PatchN. + +------------------------------------------------------------------- +Sun Nov 20 16:04:19 UTC 2022 - Bernhard Wiedemann + +- Make PGO training independent from number of build machine cores + (boo#1040589) + +------------------------------------------------------------------- +Mon Nov 7 08:09:38 UTC 2022 - Martin Liška + +- Update to 0.15 release: + * Uses xxHash hashing algorithm. A 8% ~ 14% speedup. + * Set endianity of multifile using -e, --multifile-endian. + * Set pointer size of multifile using -p, --multifile-pointer-size + * Process files in parallel using -j N --jobs N. The default is + processors / 2. Disabled when multifile is used. + * Prints abbrev or DIE offset for Unknown DWARF error messages. + * All testcases have been updated to work against the binutils 2.39. +- Remove upstreamed patches: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + * dwz-use-grep-E-instead-of-egrep.patch +- Rebased patches: + * dwz-remove-odr-struct-multifile.sh.patch + * dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Thu Sep 8 17:53:27 UTC 2022 - Martin Liška + +- Add dwz-use-grep-E-instead-of-egrep.patch in order + to fix build with latest grep package. + +------------------------------------------------------------------- +Thu Apr 28 10:08:03 UTC 2022 - Martin Liška + +- Drop binutils-gold dependency for testsuite as binutils-gold + is deprecated and will be removed in the future. + +------------------------------------------------------------------- +Wed Feb 2 09:20:10 UTC 2022 - Martin Liška + +- Silent warnings for tramp3d compilation. + +------------------------------------------------------------------- +Wed Jan 5 06:20:01 UTC 2022 - Martin Liška + +- Add dwz-remove-odr-struct-multifile.sh.patch that removes problematic + testcase. + +------------------------------------------------------------------- +Thu Dec 23 10:59:49 UTC 2021 - Martin Liška + +- Start using -O3 and PGO with tramp3d as training binary. + +------------------------------------------------------------------- +Wed Mar 17 15:54:22 UTC 2021 - Tom de Vries + +- Backport fixes for odr PR [swo#27578]: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch +- Backport testsuite fix: + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + +------------------------------------------------------------------- +Wed Mar 17 15:38:20 UTC 2021 - Tom de Vries + +- DWZ 0.14 update: + * Dropped patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + - dwz-update-suse-copyright-years.patch + - dwz-update-version.patch + * Updated patch: + - dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Fri Feb 26 12:07:30 UTC 2021 - Tom de Vries + +- Change Version tag from 0.14rc1 to 0.14~rc1 + * Rename dwz-0.14rc1.tar.xz to dwz-0.14~rc1.tar.xz + +------------------------------------------------------------------- +Fri Feb 26 09:31:00 UTC 2021 - Tom de Vries + +- Fix testsuite build fail on riscv64: + * dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + +------------------------------------------------------------------- +Fri Feb 26 08:38:53 UTC 2021 - Tom de Vries + +- Update reported dwz version + * dwz-update-version.patch + +------------------------------------------------------------------- +Fri Feb 26 07:52:22 UTC 2021 - Tom de Vries + +- DWZ 0.14-rc1 (master branch commit 0d391bf) update: + * Dropped patches: + - dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + - dwz-fix-die-no-multifile-propagation.patch + - dwz-fix-refd-NULL-assertion-in-write_die.patch + - dwz-fix-reference-from-pu-to-cu.patch + - dwz-fix-segfault-in-die_cu.patch + - dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + - dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + - dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + - dwz-update-version-copyright-message.patch + * Added patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-enable-odr-by-default.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-update-suse-copyright-years.patch + * Added BuildRequires gcc-c++ +------------------------------------------------------------------- +Thu Jan 7 10:21:31 UTC 2021 - Tom de Vries + +- Fix pr24468.sh test-case with newer readelf. + * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + +------------------------------------------------------------------- +Thu Jan 7 09:15:48 UTC 2021 - Tom de Vries + +- Detect when devel-ignore-size.sh is unsupported [swo#27115]. + * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + +------------------------------------------------------------------- +Wed Aug 5 08:16:04 UTC 2020 - Tom de Vries + +- Fix error: source 0 defined multiple times. + +------------------------------------------------------------------- +Wed Aug 5 08:00:30 UTC 2020 - Tom de Vries + +- Silence warning "dwz-rpmlintrc is not mentioned in spec files". + +------------------------------------------------------------------- +Wed Aug 5 06:49:52 UTC 2020 - Tom de Vries + +- Add dwz-rpmlintrc. Add comment to NoSource directive. + +------------------------------------------------------------------- +Fri Jan 24 17:08:55 UTC 2020 - Tom de Vries + +- Fix segfault in die_cu [swo#25456]. + * dwz-fix-segfault-in-die_cu.patch + +------------------------------------------------------------------- +Fri Jan 17 06:30:58 UTC 2020 - Tom de Vries + +- Fix reference from compilation unit to partial unit [swo#25398]. + * dwz-fix-reference-from-pu-to-cu.patch + +------------------------------------------------------------------- +Thu Nov 28 12:56:34 UTC 2019 - Tom de Vries + +- Fix assertion failure 'refd != NULL' in write_die [swo#24169]. + * dwz-fix-refd-NULL-assertion-in-write_die.patch + +------------------------------------------------------------------- +Wed Nov 27 18:50:07 UTC 2019 - Tom de Vries + +- Fix assertion failure 'off == cu_size' in recompute_abbrevs + [swo#24764]. + * dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + +------------------------------------------------------------------- +Tue Nov 5 09:55:50 UTC 2019 - Tom de Vries + +- Fix die_no_multifile propagation [swo#25109]. + * dwz-fix-die-no-multifile-propagation.patch + +------------------------------------------------------------------- +Wed Aug 28 12:47:09 UTC 2019 - Tom de Vries + +- Disable dwz:testsuite if %{with ringdisabled} + +------------------------------------------------------------------- +Fri Aug 16 11:26:06 UTC 2019 - Tom de Vries + +- Fix copyright years in --version message: + * dwz-update-version-copyright-message.patch + +------------------------------------------------------------------- +Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries + +- Split off dwz-testsuite package using multibuild, to remove build + cycle +- Don't require binutils-gold for riscv64 + +------------------------------------------------------------------- +Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries + +- DWZ 0.13 update: + * Dropped patches: + - dwz-0.12-ignore-nobits.patch + - dwz-0.12-DW_OP_GNU_variable_value.patch + - dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + * Added BuildRequires for dejagnu, elfutils, gdb and binutils-gold. + * Add %check +- Add URL tag + +------------------------------------------------------------------- +Mon Feb 18 14:31:42 UTC 2019 - tdevries@suse.com + +- Add dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + to fix assert on cc1 binary from gcc bootstrap-lto [swo#24195]. + +------------------------------------------------------------------- +Wed Apr 11 11:02:06 UTC 2018 - rguenther@suse.com + +- Add dwz-0.12-DW_OP_GNU_variable_value.patch to handle + DW_OP_GNU_variable_value. + +------------------------------------------------------------------- +Wed Mar 14 13:32:56 UTC 2018 - mliska@suse.cz + +- Run spec-cleaner on the package. + +------------------------------------------------------------------- +Tue Mar 7 09:57:14 UTC 2017 - rguenther@suse.com + +- Adjust dwz-0.12-ignore-nobits.patch to also handle non-monotonically + increasing sh_offset as created by the kernel linker script. + +------------------------------------------------------------------- +Tue Feb 21 13:35:26 UTC 2017 - rguenther@suse.com + +- Add dwz-0.12-ignore-nobits.patch to ignore SHT_NOBITS sections + that are placed out-of-order by objcopy when extracting debuginfo + and place them at sh_offset zero. + +------------------------------------------------------------------- +Tue Nov 29 08:51:04 UTC 2016 - rguenther@suse.com + +- Update to new upstream version 0.12 +* Fix up alignment of non-allocated sections and section header table + after sections which have changed size. + +------------------------------------------------------------------- +Wed Dec 10 15:38:40 UTC 2014 - jengelh@inai.de + +- Update to new upstream version 0.11 +* fix iterative hashing on big-endian targets +* optimize DW_FORM_data[48] DW_AT_high_pc that GCC 4.8 produces +* fix up handling of DIE equality if more than one DIE in the same + CU compare equal +* check DW_FORM_ref_addr properly during fi_multifile phase +* when creating DW_AT_stmt_list, use DW_FORM_sec_offset for dwarf4 + and DW_FORM_data4 for dwarf[23] rather than vice versa +* handle .gdb_index version 7 and 8 + +------------------------------------------------------------------- +Wed Jun 27 14:04:01 CEST 2012 - pth@suse.de + +- Initial package + + diff --git a/dwz.spec b/dwz.spec new file mode 100644 index 0000000..3cb023b --- /dev/null +++ b/dwz.spec @@ -0,0 +1,153 @@ +# +# spec file for package dwz +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define flavor @BUILD_FLAVOR@%{nil} + +%bcond_with ringdisabled + +%if "%flavor" == "testsuite" +%if %{with ringdisabled} +ExclusiveArch: do_not_build +%endif +%define build_main 0 +%define build_testsuite 1 +%else +%define build_main 1 +%define build_testsuite 0 +%endif + +%if %{build_testsuite} +%define debug_package %{nil} +%endif + +%if %{build_main} +%define name_suffix %{nil} +%else +%define name_suffix -%{flavor} +%endif + +Name: dwz%{name_suffix} +Version: 0.15 +Release: 0 +%if %{build_main} +Summary: DWARF optimization and duplicate removal tool +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +%if %{build_testsuite} +Summary: Testsuite results from DWZ +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +#Git-Clone: git://sourceware.org/git/dwz +#Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary +Source: dwz-%{version}.tar.xz +URL: https://sourceware.org/dwz/ +BuildRequires: gcc-c++ +BuildRequires: libelf-devel +BuildRequires: xxhash-devel +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: dejagnu +BuildRequires: elfutils +BuildRequires: gdb +%endif + +%if !%{build_main} +# It's a bit pointless to ship two identical source packages, one for dwz and +# one for dwz-testsuite. So we make the second one small by excluding the +# source archive. We could do the same for the patches with NoPatch, but the +# gain is smaller there and looks more cumbersome to maintain. +NoSource: 0 +%endif + +Source1: dwz-rpmlintrc +Source2: tramp3d-v4.cpp.xz + +Patch1: dwz-enable-odr-by-default.patch +Patch2: dwz-remove-odr-struct-multifile.sh.patch + +%if %{build_main} +%description +dwz optimizes DWARF debugging information contained in ELF shared +libraries and executables for size, by replacing DWARF information +representation with equivalent smaller representation where possible, +and by reducing the amount of duplication using techniques from the +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. + +The tool handles DWARF 32-bit format debugging sections of versions +2, 3 and 4 and GNU extensions on top of those, though using DWARF 4 +or worst case DWARF 3 is strongly recommended. + +When not using the -m option (multifile mode), GDB CVS snapshot (soon to be +7.5) is sufficient, when using -m option, GDB from a git branch +http://sources.redhat.com/git/?p=archer.git;a=shortlog;h=refs/heads/archer-tromey-dwz-multifile +is needed. +%endif + +%if %{build_testsuite} +%description +This package contains the testsuite results from DWZ. +%endif + +%prep +%autosetup -p1 -n dwz + +cp %{SOURCE2} . +xz -d tramp3d-v4.cpp.xz + +%build +%define flags %{optflags} -O3 + +# Do PGO with tramp3d as input file +%make_build CFLAGS="%{flags} -fprofile-generate" LDFLAGS="-fprofile-generate" +g++ tramp3d-v4.cpp -O2 -g -w -o t1 +cp t1 t2 +cp t1 t3 +cp t1 t4 +./dwz -j 1 -m tmp.debug t1 t2 t3 t4 +make clean +%make_build CFLAGS="%{flags} -fprofile-use" LDFLAGS="-fprofile-use" + +%check +%if %{build_testsuite} +make -k check +%endif + +%install +%if %{build_main} +%make_install +%endif + +%if %{build_main} +%files +%license COPYING +%{_bindir}/dwz +%{_mandir}/man1/dwz.1%{?ext_man} +%endif + +%if %{build_testsuite} +%files +%defattr(-,root,root) +%doc dwz.sum +%doc dwz.log +%endif + +%changelog diff --git a/tramp3d-v4.cpp.xz b/tramp3d-v4.cpp.xz new file mode 100644 index 0000000..758f90b --- /dev/null +++ b/tramp3d-v4.cpp.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcc7c2d957b9baa4bab5eecc3ffa2e0e545ca77b00495ba158654cdee7a02d22 +size 153712 -- 2.51.1 From 3cf25e9e1609de88fa941d2db9fcbaf06a5c21276ccf325762cf765c76b6462b Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 4 Mar 2025 08:38:36 +0000 Subject: [PATCH 2/3] - Add patch (backport from upstream trunk): * dwz-add-support-for-version-9-gdb-index.patch * dwz-make-dejagnu-logs-more-elaborate.patch * dwz-make-dejagnu-test-names-environment-insensitive.patch * dwz-testsuite-fix-finding-gdb-without-which.patch - Drop patch: * dwz-remove-odr-struct-multifile.sh.patch OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=52 --- .gitattributes | 23 ++ .gitignore | 1 + _multibuild | 3 + dwz-0.15.tar.xz | 3 + dwz-add-support-for-version-9-gdb-index.patch | 377 ++++++++++++++++++ dwz-enable-odr-by-default.patch | 35 ++ dwz-make-dejagnu-logs-more-elaborate.patch | 43 ++ ...u-test-names-environment-insensitive.patch | 110 +++++ dwz-remove-odr-struct-multifile.sh.patch | 67 ++++ dwz-rpmlintrc | 25 ++ ...tsuite-fix-finding-gdb-without-which.patch | 31 ++ dwz.changes | 288 +++++++++++++ dwz.spec | 156 ++++++++ tramp3d-v4.cpp.xz | 3 + 14 files changed, 1165 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 dwz-0.15.tar.xz create mode 100644 dwz-add-support-for-version-9-gdb-index.patch create mode 100644 dwz-enable-odr-by-default.patch create mode 100644 dwz-make-dejagnu-logs-more-elaborate.patch create mode 100644 dwz-make-dejagnu-test-names-environment-insensitive.patch create mode 100644 dwz-remove-odr-struct-multifile.sh.patch create mode 100644 dwz-rpmlintrc create mode 100644 dwz-testsuite-fix-finding-gdb-without-which.patch create mode 100644 dwz.changes create mode 100644 dwz.spec create mode 100644 tramp3d-v4.cpp.xz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..964176c --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + testsuite + diff --git a/dwz-0.15.tar.xz b/dwz-0.15.tar.xz new file mode 100644 index 0000000..3100349 --- /dev/null +++ b/dwz-0.15.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3845310e34e306747207e1038bbc4085c7e2edff8de20f7ca7f3884ca752e4 +size 150080 diff --git a/dwz-add-support-for-version-9-gdb-index.patch b/dwz-add-support-for-version-9-gdb-index.patch new file mode 100644 index 0000000..8918655 --- /dev/null +++ b/dwz-add-support-for-version-9-gdb-index.patch @@ -0,0 +1,377 @@ +From 1ae37f476bc6c9f7a756fee4830766f03600866c Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 2 Oct 2024 23:20:57 +0200 +Subject: [PATCH 4/4] Add support for version 9 .gdb_index + +Version 9 .gdb_index adds a new shortcut table. The table itself is +just two offset_type values (2 * 4 bytes) describing the language of +the main function expresses as an DW_LANG_ constant and the offset of +the main function's name in the constant pool. + +The offset to the shortcut table in the header is between the symbol +table and constant pool offsets. + +write_gdb_index explicitly copies the function's name into the new +constant pool (if lang is not zero) because it might not be an offset +to an existing name of a symbol. + +Some extra checks and warnings have been added to let the user know +when parsing the .gdb_index fails. Add a const char *file argument to +write_gdb_index for better error reporting. + +Add -D_GNU_SOURCE to Makefile CFLAGS_COMMON to use memrchr. + +This fixes the gdb-add-index.sh testcase with gdb 15+. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32146 +--- + Makefile | 2 +- + dwz.c | 180 +++++++++++++++++++++++++++++++++++++++++++------------ + 2 files changed, 144 insertions(+), 38 deletions(-) + +diff --git a/Makefile b/Makefile +index 8b7cf76..3dc6c6f 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,7 +8,7 @@ CFLAGS = -O2 -g + DWZ_VERSION := $(shell cat $(srcdir)/VERSION) + CFLAGS_VERSION = -DDWZ_VERSION='"$(DWZ_VERSION)"' + CFLAGS_COPYRIGHT = $(shell cat $(srcdir)/COPYRIGHT_YEARS) +-CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64 ++CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + XXH_PROG = "\#define XXH_INLINE_ALL 1\n\#include \n" + XXH_INLINE_ALL_WORKS = $(shell printf $(XXH_PROG) \ + | $(CC) -xc -c - -o /dev/null 2>/dev/null \ +diff --git a/dwz.c b/dwz.c +index 3bc6038..da4121f 100644 +--- a/dwz.c ++++ b/dwz.c +@@ -1,6 +1,7 @@ + /* Copyright (C) 2001-2021 Red Hat, Inc. + Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2019-2021 SUSE LLC. ++ Copyright (C) 2024 Mark J. Wielaard + Written by Jakub Jelinek , 2012. + + This program is free software; you can redistribute it and/or modify +@@ -13222,12 +13223,13 @@ gdb_index_tu_cmp (const void *p, const void *q) + /* Construct new .gdb_index section in malloced memory + if it needs adjustment. */ + static void +-write_gdb_index (void) ++write_gdb_index (const char *file) + { + dw_cu_ref cu, cu_next, first_tu = NULL; +- unsigned char *gdb_index, *ptr, *inptr, *end; ++ unsigned char *gdb_index, *ptr, *inptr, *end, *conststart; + unsigned int ncus = 0, npus = 0, ntus = 0, ndelcus = 0, ver; + unsigned int culistoff, cutypesoff, addressoff, symboloff, constoff; ++ unsigned int headersize, shortcutoff, nextoff; + unsigned int *tuindices = NULL, tuidx = 0, *cumap = NULL, i, j, k; + bool fail = false; + +@@ -13235,14 +13237,27 @@ write_gdb_index (void) + if (likely (!op_multifile) + && (debug_sections[GDB_INDEX].data == NULL + || debug_sections[GDB_INDEX].size < 0x18)) +- return; ++ { ++ if (file && debug_sections[GDB_INDEX].data != NULL) ++ error (0, 0, "%s: .gdb_index too small 0x%zx", file, ++ debug_sections[GDB_INDEX].size); ++ return; ++ } + inptr = (unsigned char *) debug_sections[GDB_INDEX].data; + if (unlikely (op_multifile)) + ver = multi_gdb_index_ver; + else + ver = buf_read_ule32 (inptr); +- if (ver < 4 || ver > 8) +- return; ++ if (ver < 4 || ver > 9) ++ { ++ if (file) ++ error (0, 0, "%s: Unknown .gdb_index section version 0x%x", file, ver); ++ return; ++ } ++ ++ /* Version 9 added a shortcut table offset (4 bytes) between the ++ address and symbol table offsets. */ ++ headersize = ver < 9 ? 0x18 : 0x1c; + + for (cu = first_cu; cu; cu = cu->cu_next) + if (cu->cu_kind == CU_PU) +@@ -13259,25 +13274,38 @@ write_gdb_index (void) + /* Starting with version 7 CU indexes are limited to 24 bits, + so if we have more CUs, give up. */ + if (npus + ncus + ntus - ndelcus >= (1U << 24)) +- return; ++ { ++ if (file) ++ error (0, 0, "%s: Cannot write %u CUs to .gdb_index", ++ file, npus + ncus + ntus - ndelcus); ++ return; ++ } + + if (unlikely (op_multifile)) + { + assert (ncus == 0 && ntus == 0); ++ /* Version 9 index contain an (empty) shortcut table of 2 32bit ++ entries (8 byte). */ + debug_sections[GDB_INDEX].new_size +- = 0x18 + npus * 16 + 16; ++ = headersize + npus * 16 + 16 + (ver >= 9 ? 8 : 0); + gdb_index = malloc (debug_sections[GDB_INDEX].new_size); + if (gdb_index == NULL) + dwz_oom (); + debug_sections[GDB_INDEX].new_data = gdb_index; + /* Write new header. */ + buf_write_le32 (gdb_index + 0x00, ver); +- buf_write_le32 (gdb_index + 0x04, 0x18); +- buf_write_le32 (gdb_index + 0x08, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x0c, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x10, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x14, 0x18 + npus * 16 + 16); +- ptr = gdb_index + 0x18; ++ buf_write_le32 (gdb_index + 0x04, headersize); ++ buf_write_le32 (gdb_index + 0x08, headersize + npus * 16); ++ buf_write_le32 (gdb_index + 0x0c, headersize + npus * 16); ++ buf_write_le32 (gdb_index + 0x10, headersize + npus * 16); ++ if (ver >= 9) ++ { ++ buf_write_le32 (gdb_index + 0x14, headersize + npus * 16 + 16); ++ buf_write_le32 (gdb_index + 0x18, headersize + npus * 16 + 16 + 8); ++ } ++ else ++ buf_write_le32 (gdb_index + 0x14, headersize + npus * 16 + 16); ++ ptr = gdb_index + headersize; + /* Write new CU list. */ + for (cu = first_cu; cu; cu = cu->cu_next) + { +@@ -13290,6 +13318,10 @@ write_gdb_index (void) + } + /* Write an empty hash table (with two entries). */ + memset (ptr, '\0', 16); ++ /* Write an empty shortcut table (two zero offset types, ++ indicating no main function or language). */ ++ if (ver >= 9) ++ memset (ptr + 16, '\0', 8); + return; + } + +@@ -13297,18 +13329,34 @@ write_gdb_index (void) + cutypesoff = buf_read_ule32 (inptr + 0x08); + addressoff = buf_read_ule32 (inptr + 0x0c); + symboloff = buf_read_ule32 (inptr + 0x10); +- constoff = buf_read_ule32 (inptr + 0x14); +- if (culistoff != 0x18 +- || cutypesoff != 0x18 + ncus * 16 ++ if (ver >= 9) ++ { ++ shortcutoff = buf_read_ule32 (inptr + 0x14); ++ constoff = buf_read_ule32 (inptr + 0x18); ++ nextoff = shortcutoff; ++ } ++ else ++ { ++ shortcutoff = 0; ++ constoff = buf_read_ule32 (inptr + 0x14); ++ nextoff = constoff; ++ } ++ ++ if (culistoff != headersize ++ || cutypesoff != headersize + ncus * 16 + || addressoff != cutypesoff + ntus * 24 + || symboloff < addressoff + || ((symboloff - addressoff) % 20) != 0 +- || constoff < symboloff +- || ((constoff - symboloff) & (constoff - symboloff - 1)) != 0 +- || ((constoff - symboloff) & 7) != 0 ++ || nextoff < symboloff ++ || ((nextoff - symboloff) & (nextoff - symboloff - 1)) != 0 ++ || ((nextoff - symboloff) & 7) != 0 + || debug_sections[GDB_INDEX].size < constoff) +- return; +- inptr += 0x18; ++ { ++ if (file) ++ error (0, 0, "%s: Unexpected offsets in .gdb_index", file); ++ return; ++ } ++ inptr += headersize; + if (ndelcus) + cumap = (unsigned int *) + obstack_alloc (&ob2, ncus * sizeof (unsigned int)); +@@ -13319,6 +13367,8 @@ write_gdb_index (void) + { + if (cumap) + obstack_free (&ob2, (void *) cumap); ++ if (file) ++ error (0, 0, "%s: unexpected cu cu_offset in .gdb_index", file); + return; + } + inptr += 16; +@@ -13353,6 +13403,8 @@ write_gdb_index (void) + obstack_free (&ob2, (void *) cumap); + else + obstack_free (&ob2, (void *) tuindices); ++ if (file) ++ error (0, 0, "%s: unexpected tui cu_offset in .gdb_index", file); + return; + } + } +@@ -13375,8 +13427,16 @@ write_gdb_index (void) + buf_write_le32 (gdb_index + 0x08, cutypesoff + npus * 16 - ndelcus * 16); + buf_write_le32 (gdb_index + 0x0c, addressoff + npus * 16 - ndelcus * 16); + buf_write_le32 (gdb_index + 0x10, symboloff + npus * 16 - ndelcus * 16); +- buf_write_le32 (gdb_index + 0x14, constoff + npus * 16 - ndelcus * 16); +- ptr = gdb_index + 0x18; ++ if (ver >= 9) ++ { ++ buf_write_le32 (gdb_index + 0x14, ++ shortcutoff + npus * 16 - ndelcus * 16); ++ buf_write_le32 (gdb_index + 0x18, ++ constoff + npus * 16 - ndelcus * 16); ++ } ++ else ++ buf_write_le32 (gdb_index + 0x14, constoff + npus * 16 - ndelcus * 16); ++ ptr = gdb_index + headersize; + /* Write new CU list. */ + for (cu = first_cu; cu; cu = cu_next) + { +@@ -13434,12 +13494,43 @@ write_gdb_index (void) + inptr += 20; + } + /* Copy the symbol hash table. */ +- memcpy (ptr, inptr, constoff - symboloff); ++ memcpy (ptr, inptr, nextoff - symboloff); + /* Clear the const pool initially. */ +- memset (ptr + (constoff - symboloff), '\0', ++ memset (ptr + (nextoff - symboloff) + (ver < 9 ? 0 : 8), '\0', + debug_sections[GDB_INDEX].size - constoff); ++ /* Copy the shortcut table. */ ++ if (ver >= 9) ++ { ++ unsigned char *inscptr = inptr + (nextoff - symboloff); ++ unsigned char *scptr = ptr + (nextoff - symboloff); ++ uint32_t lang = buf_read_ule32 (inscptr); ++ uint32_t name = buf_read_ule32 (inscptr + 4); ++ buf_write_le32 (scptr, lang); ++ buf_write_le32 (scptr + 4, name); ++ ++ /* If lang is not zero then put the name in the const table, it ++ might not be an offset to the name of a symbol. */ ++ if (lang != 0) ++ { ++ if (name > debug_sections[GDB_INDEX].size - constoff - 1 ++ || memrchr (debug_sections[GDB_INDEX].data ++ + debug_sections[GDB_INDEX].size, '\0', ++ debug_sections[GDB_INDEX].size ++ - constoff - name) == NULL) ++ { ++ error (0, 0, "%s: bad shortcut table name in .gdb_index", file); ++ goto fail; ++ } ++ strcpy ((char *) ptr + (constoff - symboloff) + name, ++ (char *) inptr + (constoff - symboloff) + name); ++ } ++ } + ptr = ptr + (constoff - symboloff); +- end = inptr + (constoff - symboloff); ++ end = inptr + (nextoff - symboloff); ++ if (ver >= 9) ++ conststart = end + (constoff - nextoff); ++ else ++ conststart = end; + /* Finally copy over const objects into the const pool, strings as is, + CU vectors with CU indexes adjusted. */ + while (inptr < end) +@@ -13450,9 +13541,11 @@ write_gdb_index (void) + inptr += 8; + if (name == 0 && cuvec == 0) + continue; +- if (name > debug_sections[GDB_INDEX].size - constoff - 1 +- || cuvec > debug_sections[GDB_INDEX].size - constoff - 4) ++ if (name > debug_sections[GDB_INDEX].size - nextoff - 1 ++ || cuvec > debug_sections[GDB_INDEX].size - nextoff - 4) + { ++ if (file) ++ error (0, 0, "%s: name or cuvec too large in .gdb_index", file); + fail: + free (gdb_index); + debug_sections[GDB_INDEX].new_size = 0; +@@ -13460,26 +13553,36 @@ write_gdb_index (void) + } + if (ptr[name] == '\0') + { +- unsigned char *strend = end + name; ++ unsigned char *strend = conststart + name; + while (*strend != '\0') + { + if (strend + 1 +- == end + (debug_sections[GDB_INDEX].size - constoff)) +- goto fail; ++ == conststart + (debug_sections[GDB_INDEX].size - constoff)) ++ { ++ if (file) ++ error (0, 0, "%s: name too large in .gdb_index", file); ++ goto fail; ++ } + strend++; + } +- memcpy (ptr + name, end + name, strend + 1 - (end + name)); ++ memcpy (ptr + name, conststart + name, ++ strend + 1 - (conststart + name)); + } + if (buf_read_ule32 (ptr + cuvec) == 0) + { +- unsigned int count = buf_read_ule32 (end + cuvec); ++ unsigned int count = buf_read_ule32 (conststart + cuvec); + if (count * 4 + > debug_sections[GDB_INDEX].size - constoff - cuvec - 4) +- goto fail; ++ { ++ if (file) ++ error (0, 0, "%s: count (%u) too large in .gdb_index", ++ file, count); ++ goto fail; ++ } + buf_write_le32 (ptr + cuvec, count); + for (i = 0; i < count; i++) + { +- j = buf_read_ule32 (end + cuvec + (i + 1) * 4); ++ j = buf_read_ule32 (conststart + cuvec + (i + 1) * 4); + if (ver >= 7) + k = j & ((1U << 24) - 1); + else +@@ -13506,6 +13609,9 @@ write_gdb_index (void) + obstack_free (&ob2, (void *) tuindices); + if (fail) + { ++ if (file) ++ error (0, 0, "%s: fail in .gdb_index", file); ++ + free (debug_sections[GDB_INDEX].new_data); + debug_sections[GDB_INDEX].new_data = NULL; + debug_sections[GDB_INDEX].new_size = 0; +@@ -15549,7 +15655,7 @@ dwz (const char *file, const char *outfile, struct file_result *res) + report_progress (); + fprintf (stderr, "write_gdb_index\n"); + } +- write_gdb_index (); ++ write_gdb_index (file); + /* These sections are optional and it is unclear + how to adjust them. Just remove them. */ + debug_sections[DEBUG_PUBNAMES].new_data = NULL; +@@ -15808,7 +15914,7 @@ optimize_multifile (unsigned int *die_count) + + write_abbrev (); + write_info (die_count); +- write_gdb_index (); ++ write_gdb_index (NULL); + if (write_multifile_line ()) + goto fail; + } +-- +2.43.0 + diff --git a/dwz-enable-odr-by-default.patch b/dwz-enable-odr-by-default.patch new file mode 100644 index 0000000..aafcd37 --- /dev/null +++ b/dwz-enable-odr-by-default.patch @@ -0,0 +1,35 @@ +diff --git a/args.c b/args.c +index e93c24d..3e1113f 100644 +--- a/args.c ++++ b/args.c +@@ -66,7 +66,7 @@ int gen_cu_p = 0; + + enum die_count_methods die_count_method = estimate; + +-int odr = 0; ++int odr = 1; + enum odr_mode odr_mode = ODR_LINK; + + /* Filename if inter-file size optimization should be performed. */ +@@ -202,7 +202,7 @@ static struct option_help dwz_common_options_help[] = + "Don't optimize files larger than this limit." }, + { NULL, "odr", NULL, NULL, + NULL }, +- { NULL, "no-odr", NULL, "Disabled", ++ { NULL, "no-odr", NULL, "Enabled", + "Enable/disable one definition rule optimization." }, + { NULL, "odr-mode", "", "link", + "Set aggressiveness level of one definition rule optimization." }, +diff --git a/dwz.1 b/dwz.1 +index 1cff329..f3cd3dd 100644 +--- a/dwz.1 ++++ b/dwz.1 +@@ -133,7 +133,7 @@ considered equal. This has the effect that DIEs referring to distinct DIEs + representing the same type (like f.i. pointer type DIEs) are considered equal, + and may be deduplicated. The status of this optimization is experimental. + It's disabled in low-mem mode. +-Disabled by default. ++Enabled by default. + .TP + .B \-\-odr-mode= + Set the One-Definition-Rule optimization aggressiveness: basic or link. diff --git a/dwz-make-dejagnu-logs-more-elaborate.patch b/dwz-make-dejagnu-logs-more-elaborate.patch new file mode 100644 index 0000000..4ca939b --- /dev/null +++ b/dwz-make-dejagnu-logs-more-elaborate.patch @@ -0,0 +1,43 @@ +From 5ae6047adef9648f50e007b23df09d38de5e0729 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Sat, 18 Feb 2023 12:36:15 +0100 +Subject: [PATCH 1/4] make dejagnu logs more elaborate + +dwz-tests.exp produces totally barebones dwz.log files, basically +duplicating the .sum file. If there are any errors, there's +basically no info to go on. + +The patch runs the .sh subtests in -x trace mode, and logs +stdout/stderr to the .log file, so e.g. bunsen can safe-keep it. +Otherwise I believe no-op. +--- + testsuite/dwz.tests/dwz-tests.exp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 811767f..85e6fcd 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -116,16 +116,17 @@ foreach test $tests { + exec mkdir $dir + + cd $dir +- if { [catch { exec sh -e $test } msg] } { ++ if { [catch { exec sh -x -e $test 2>@1 } msg] } { ++ verbose -log "$msg" + if { [lindex $::errorCode 0] == "CHILDSTATUS" && \ + [lindex $::errorCode 2] == 77 } { + unsupported "$test" + exec rm -Rf $dir + } else { +- puts "$msg" + fail "$test" + } + } else { ++ verbose -log "$msg" + if { [file exists dwz.info ] } { + set info [exec cat dwz.info] + verbose -log "$test:" 1 +-- +2.43.0 + diff --git a/dwz-make-dejagnu-test-names-environment-insensitive.patch b/dwz-make-dejagnu-test-names-environment-insensitive.patch new file mode 100644 index 0000000..31945c6 --- /dev/null +++ b/dwz-make-dejagnu-test-names-environment-insensitive.patch @@ -0,0 +1,110 @@ +From 9621200e66f0339da5a80e1abf46f4789a4a3690 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Wed, 1 Mar 2023 16:51:58 +0100 +Subject: [PATCH 2/4] make dejagnu test names environment-insensitive + +Previous versions of dwz-tests.exp emit the full path names to the +per-test .sh scripts into the .sum/.log files. This version replaces +those patn names with just the $basename, which is enough to identify +the tests uniquely, and allows proper regression/comparison analysis. + +https://sourceware.org/bugzilla/show_bug.cgi?id=30182 +--- + testsuite/dwz.tests/dwz-tests.exp | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 85e6fcd..20affea 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -27,20 +27,20 @@ foreach test $tests { + if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } { + # Some error occurred in the supported test, f.i. DWARF in min + # unsupported by readelf. +- unsupported "$test" ++ unsupported $basename + continue + } + if { $matches != 2 } { + # The exec min is used for the regression test for pr24341, but it + # only functions as such if the DWARF only contains the CUs of the + # test-case itself. +- unsupported "$test" ++ unsupported $basename + continue + } + } + if { $basename == "pr24172.sh" } { + if { ![istarget x86_64-*-*] } { +- unsupported "$test" ++ unsupported $basename + continue + } + lappend required_execs "dw2-skip-prologue" +@@ -62,17 +62,17 @@ foreach test $tests { + } + if { ![istarget x86_64-*-*] } { + if { $basename == "pr24468.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + if { $basename == "ld-2.26.1-multifile.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + } + if { $basename == "gdb-add-index.sh" } { + if { [catch { exec which gdb-add-index } ] } { +- unsupported "$test" ++ unsupported $basename + continue + } + } +@@ -82,7 +82,7 @@ foreach test $tests { + if { $basename == "eu-strip-unstrip.sh" || \ + $basename == "eu-strip-unstrip-multifile.sh" || \ + $basename == "pr24173.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + } +@@ -107,7 +107,7 @@ foreach test $tests { + } + } + if { $unsupported == 1 } { +- unsupported "$test" ++ unsupported $basename + continue + } + +@@ -120,10 +120,10 @@ foreach test $tests { + verbose -log "$msg" + if { [lindex $::errorCode 0] == "CHILDSTATUS" && \ + [lindex $::errorCode 2] == 77 } { +- unsupported "$test" ++ unsupported $basename + exec rm -Rf $dir + } else { +- fail "$test" ++ fail $basename + } + } else { + verbose -log "$msg" +@@ -136,9 +136,9 @@ foreach test $tests { + set file_list [glob -nocomplain "$dir/*"] + if {[llength $file_list] != 0} { + puts "$dir is not empty" +- fail "$test" ++ fail $basename + } else { +- pass "$test" ++ pass $basename + exec rm -Rf $dir + } + } +-- +2.43.0 + diff --git a/dwz-remove-odr-struct-multifile.sh.patch b/dwz-remove-odr-struct-multifile.sh.patch new file mode 100644 index 0000000..705fab4 --- /dev/null +++ b/dwz-remove-odr-struct-multifile.sh.patch @@ -0,0 +1,67 @@ +diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh +deleted file mode 100755 +index 5961abf..0000000 +--- a/testsuite/dwz.tests/odr-struct-multifile.sh ++++ /dev/null +@@ -1,61 +0,0 @@ +-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 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 2 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- case $name in +- member_one|member_two) +- [ $cnt -eq 2 ] +- ;; +- member_three|member_four) +- [ $cnt -eq 1 ] +- ;; +- esac +-done +- +-decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true) +- +-$execs/dwz-for-test --odr 1 2 -m 3 +- +-verify-dwarf.sh 1 +-verify-dwarf.sh 3 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-# Even with -wN readelf 2.38-15.fc37 follows and prints the contents +-# of the alt file. So make sure it cannot do that by removing it. +-rm 3 +- +-for name in aaa bbb ccc; do +- 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 $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 0 ] +-done +- +-rm -f 1 2 3 diff --git a/dwz-rpmlintrc b/dwz-rpmlintrc new file mode 100644 index 0000000..d65bb5d --- /dev/null +++ b/dwz-rpmlintrc @@ -0,0 +1,25 @@ +# The package should _not_ be noarch, testresults differ from architecture +# to architecture. +addFilter("dwz-testsuite.* no-binary") + +# The rpmlint warning is: +# dwz-testsuite.nosrc: W: invalid-spec-name +# The spec file name (without the .spec suffix) must match the package name +# ("Name:" tag). Either rename your package or the specfile. +# This seems to be a multibuild artifact. The package name is dwz-testsuite, +# but the specfile filename is dwz.spec. The only way we can fix this is by +# reverting to a two-specfile setup. +# +# FTR, the warning comes paired with these grep failures in the "Preparing +# packages log": +# ... testing for empty debuginfo packages +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# ... running 50-check-filelist +# ... +# ... testing devel dependencies required by libtool .la files +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# (can be skipped by "skip-check-libtool-deps" anywhere in spec) +# ... running 50-check-packaged-twice +# +# So, skip the rpmlint warning. This doesn't fix the grep fails. +addFilter("dwz-testsuite.* invalid-spec-name") diff --git a/dwz-testsuite-fix-finding-gdb-without-which.patch b/dwz-testsuite-fix-finding-gdb-without-which.patch new file mode 100644 index 0000000..5e4597a --- /dev/null +++ b/dwz-testsuite-fix-finding-gdb-without-which.patch @@ -0,0 +1,31 @@ +From 0171f3e7ac09fa44cb1eb299f2703faa113a207e Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sat, 27 Jul 2024 15:07:56 +0100 +Subject: [PATCH 3/4] testsuite: fix finding gdb without `which` + +which isn't considered portable. Some Linux distributions like Debian and +Gentoo are seeking to remove it from their base set of packages [0]. + +Use POSIX's `command -v` instead. + +[0] https://lwn.net/Articles/874049/ +--- + testsuite/dwz.tests/dwz-tests.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 20affea..8e407d4 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -71,7 +71,7 @@ foreach test $tests { + } + } + if { $basename == "gdb-add-index.sh" } { +- if { [catch { exec which gdb-add-index } ] } { ++ if { [catch { exec sh -c "command -v gdb-add-index" } ] } { + unsupported $basename + continue + } +-- +2.43.0 + diff --git a/dwz.changes b/dwz.changes new file mode 100644 index 0000000..dd09b79 --- /dev/null +++ b/dwz.changes @@ -0,0 +1,288 @@ +------------------------------------------------------------------- +Tue Mar 4 08:30:59 UTC 2025 - Tom de Vries + +- Add patch (backport from upstream trunk): + * dwz-add-support-for-version-9-gdb-index.patch + * dwz-make-dejagnu-logs-more-elaborate.patch + * dwz-make-dejagnu-test-names-environment-insensitive.patch + * dwz-testsuite-fix-finding-gdb-without-which.patch +- Drop patch: + * dwz-remove-odr-struct-multifile.sh.patch + +------------------------------------------------------------------- +Fri Dec 20 07:47:14 UTC 2024 - Martin Hauke + +- Use %{SOURCE2} macro instead of hardcoding the source file name/path. + This makes the spec file compatible with rpmbuild. + +------------------------------------------------------------------- +Mon Feb 26 08:07:43 UTC 2024 - Dominique Leuenberger + +- Use %autosetup macro. Allows to eliminate the usage of deprecated + PatchN. + +------------------------------------------------------------------- +Sun Nov 20 16:04:19 UTC 2022 - Bernhard Wiedemann + +- Make PGO training independent from number of build machine cores + (boo#1040589) + +------------------------------------------------------------------- +Mon Nov 7 08:09:38 UTC 2022 - Martin Liška + +- Update to 0.15 release: + * Uses xxHash hashing algorithm. A 8% ~ 14% speedup. + * Set endianity of multifile using -e, --multifile-endian. + * Set pointer size of multifile using -p, --multifile-pointer-size + * Process files in parallel using -j N --jobs N. The default is + processors / 2. Disabled when multifile is used. + * Prints abbrev or DIE offset for Unknown DWARF error messages. + * All testcases have been updated to work against the binutils 2.39. +- Remove upstreamed patches: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + * dwz-use-grep-E-instead-of-egrep.patch +- Rebased patches: + * dwz-remove-odr-struct-multifile.sh.patch + * dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Thu Sep 8 17:53:27 UTC 2022 - Martin Liška + +- Add dwz-use-grep-E-instead-of-egrep.patch in order + to fix build with latest grep package. + +------------------------------------------------------------------- +Thu Apr 28 10:08:03 UTC 2022 - Martin Liška + +- Drop binutils-gold dependency for testsuite as binutils-gold + is deprecated and will be removed in the future. + +------------------------------------------------------------------- +Wed Feb 2 09:20:10 UTC 2022 - Martin Liška + +- Silent warnings for tramp3d compilation. + +------------------------------------------------------------------- +Wed Jan 5 06:20:01 UTC 2022 - Martin Liška + +- Add dwz-remove-odr-struct-multifile.sh.patch that removes problematic + testcase. + +------------------------------------------------------------------- +Thu Dec 23 10:59:49 UTC 2021 - Martin Liška + +- Start using -O3 and PGO with tramp3d as training binary. + +------------------------------------------------------------------- +Wed Mar 17 15:54:22 UTC 2021 - Tom de Vries + +- Backport fixes for odr PR [swo#27578]: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch +- Backport testsuite fix: + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + +------------------------------------------------------------------- +Wed Mar 17 15:38:20 UTC 2021 - Tom de Vries + +- DWZ 0.14 update: + * Dropped patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + - dwz-update-suse-copyright-years.patch + - dwz-update-version.patch + * Updated patch: + - dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Fri Feb 26 12:07:30 UTC 2021 - Tom de Vries + +- Change Version tag from 0.14rc1 to 0.14~rc1 + * Rename dwz-0.14rc1.tar.xz to dwz-0.14~rc1.tar.xz + +------------------------------------------------------------------- +Fri Feb 26 09:31:00 UTC 2021 - Tom de Vries + +- Fix testsuite build fail on riscv64: + * dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + +------------------------------------------------------------------- +Fri Feb 26 08:38:53 UTC 2021 - Tom de Vries + +- Update reported dwz version + * dwz-update-version.patch + +------------------------------------------------------------------- +Fri Feb 26 07:52:22 UTC 2021 - Tom de Vries + +- DWZ 0.14-rc1 (master branch commit 0d391bf) update: + * Dropped patches: + - dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + - dwz-fix-die-no-multifile-propagation.patch + - dwz-fix-refd-NULL-assertion-in-write_die.patch + - dwz-fix-reference-from-pu-to-cu.patch + - dwz-fix-segfault-in-die_cu.patch + - dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + - dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + - dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + - dwz-update-version-copyright-message.patch + * Added patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-enable-odr-by-default.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-update-suse-copyright-years.patch + * Added BuildRequires gcc-c++ +------------------------------------------------------------------- +Thu Jan 7 10:21:31 UTC 2021 - Tom de Vries + +- Fix pr24468.sh test-case with newer readelf. + * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + +------------------------------------------------------------------- +Thu Jan 7 09:15:48 UTC 2021 - Tom de Vries + +- Detect when devel-ignore-size.sh is unsupported [swo#27115]. + * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + +------------------------------------------------------------------- +Wed Aug 5 08:16:04 UTC 2020 - Tom de Vries + +- Fix error: source 0 defined multiple times. + +------------------------------------------------------------------- +Wed Aug 5 08:00:30 UTC 2020 - Tom de Vries + +- Silence warning "dwz-rpmlintrc is not mentioned in spec files". + +------------------------------------------------------------------- +Wed Aug 5 06:49:52 UTC 2020 - Tom de Vries + +- Add dwz-rpmlintrc. Add comment to NoSource directive. + +------------------------------------------------------------------- +Fri Jan 24 17:08:55 UTC 2020 - Tom de Vries + +- Fix segfault in die_cu [swo#25456]. + * dwz-fix-segfault-in-die_cu.patch + +------------------------------------------------------------------- +Fri Jan 17 06:30:58 UTC 2020 - Tom de Vries + +- Fix reference from compilation unit to partial unit [swo#25398]. + * dwz-fix-reference-from-pu-to-cu.patch + +------------------------------------------------------------------- +Thu Nov 28 12:56:34 UTC 2019 - Tom de Vries + +- Fix assertion failure 'refd != NULL' in write_die [swo#24169]. + * dwz-fix-refd-NULL-assertion-in-write_die.patch + +------------------------------------------------------------------- +Wed Nov 27 18:50:07 UTC 2019 - Tom de Vries + +- Fix assertion failure 'off == cu_size' in recompute_abbrevs + [swo#24764]. + * dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + +------------------------------------------------------------------- +Tue Nov 5 09:55:50 UTC 2019 - Tom de Vries + +- Fix die_no_multifile propagation [swo#25109]. + * dwz-fix-die-no-multifile-propagation.patch + +------------------------------------------------------------------- +Wed Aug 28 12:47:09 UTC 2019 - Tom de Vries + +- Disable dwz:testsuite if %{with ringdisabled} + +------------------------------------------------------------------- +Fri Aug 16 11:26:06 UTC 2019 - Tom de Vries + +- Fix copyright years in --version message: + * dwz-update-version-copyright-message.patch + +------------------------------------------------------------------- +Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries + +- Split off dwz-testsuite package using multibuild, to remove build + cycle +- Don't require binutils-gold for riscv64 + +------------------------------------------------------------------- +Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries + +- DWZ 0.13 update: + * Dropped patches: + - dwz-0.12-ignore-nobits.patch + - dwz-0.12-DW_OP_GNU_variable_value.patch + - dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + * Added BuildRequires for dejagnu, elfutils, gdb and binutils-gold. + * Add %check +- Add URL tag + +------------------------------------------------------------------- +Mon Feb 18 14:31:42 UTC 2019 - tdevries@suse.com + +- Add dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + to fix assert on cc1 binary from gcc bootstrap-lto [swo#24195]. + +------------------------------------------------------------------- +Wed Apr 11 11:02:06 UTC 2018 - rguenther@suse.com + +- Add dwz-0.12-DW_OP_GNU_variable_value.patch to handle + DW_OP_GNU_variable_value. + +------------------------------------------------------------------- +Wed Mar 14 13:32:56 UTC 2018 - mliska@suse.cz + +- Run spec-cleaner on the package. + +------------------------------------------------------------------- +Tue Mar 7 09:57:14 UTC 2017 - rguenther@suse.com + +- Adjust dwz-0.12-ignore-nobits.patch to also handle non-monotonically + increasing sh_offset as created by the kernel linker script. + +------------------------------------------------------------------- +Tue Feb 21 13:35:26 UTC 2017 - rguenther@suse.com + +- Add dwz-0.12-ignore-nobits.patch to ignore SHT_NOBITS sections + that are placed out-of-order by objcopy when extracting debuginfo + and place them at sh_offset zero. + +------------------------------------------------------------------- +Tue Nov 29 08:51:04 UTC 2016 - rguenther@suse.com + +- Update to new upstream version 0.12 +* Fix up alignment of non-allocated sections and section header table + after sections which have changed size. + +------------------------------------------------------------------- +Wed Dec 10 15:38:40 UTC 2014 - jengelh@inai.de + +- Update to new upstream version 0.11 +* fix iterative hashing on big-endian targets +* optimize DW_FORM_data[48] DW_AT_high_pc that GCC 4.8 produces +* fix up handling of DIE equality if more than one DIE in the same + CU compare equal +* check DW_FORM_ref_addr properly during fi_multifile phase +* when creating DW_AT_stmt_list, use DW_FORM_sec_offset for dwarf4 + and DW_FORM_data4 for dwarf[23] rather than vice versa +* handle .gdb_index version 7 and 8 + +------------------------------------------------------------------- +Wed Jun 27 14:04:01 CEST 2012 - pth@suse.de + +- Initial package + + diff --git a/dwz.spec b/dwz.spec new file mode 100644 index 0000000..130fc03 --- /dev/null +++ b/dwz.spec @@ -0,0 +1,156 @@ +# +# spec file for package dwz +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define flavor @BUILD_FLAVOR@%{nil} + +%bcond_with ringdisabled + +%if "%flavor" == "testsuite" +%if %{with ringdisabled} +ExclusiveArch: do_not_build +%endif +%define build_main 0 +%define build_testsuite 1 +%else +%define build_main 1 +%define build_testsuite 0 +%endif + +%if %{build_testsuite} +%define debug_package %{nil} +%endif + +%if %{build_main} +%define name_suffix %{nil} +%else +%define name_suffix -%{flavor} +%endif + +Name: dwz%{name_suffix} +Version: 0.15 +Release: 0 +%if %{build_main} +Summary: DWARF optimization and duplicate removal tool +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +%if %{build_testsuite} +Summary: Testsuite results from DWZ +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +#Git-Clone: git://sourceware.org/git/dwz +#Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary +Source: dwz-%{version}.tar.xz +URL: https://sourceware.org/dwz/ +BuildRequires: gcc-c++ +BuildRequires: libelf-devel +BuildRequires: xxhash-devel +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: dejagnu +BuildRequires: elfutils +BuildRequires: gdb +%endif + +%if !%{build_main} +# It's a bit pointless to ship two identical source packages, one for dwz and +# one for dwz-testsuite. So we make the second one small by excluding the +# source archive. We could do the same for the patches with NoPatch, but the +# gain is smaller there and looks more cumbersome to maintain. +NoSource: 0 +%endif + +Source1: dwz-rpmlintrc +Source2: tramp3d-v4.cpp.xz + +Patch1: dwz-enable-odr-by-default.patch +Patch3: dwz-make-dejagnu-logs-more-elaborate.patch +Patch4: dwz-make-dejagnu-test-names-environment-insensitive.patch +Patch5: dwz-testsuite-fix-finding-gdb-without-which.patch +Patch6: dwz-add-support-for-version-9-gdb-index.patch + +%if %{build_main} +%description +dwz optimizes DWARF debugging information contained in ELF shared +libraries and executables for size, by replacing DWARF information +representation with equivalent smaller representation where possible, +and by reducing the amount of duplication using techniques from the +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. + +The tool handles DWARF 32-bit format debugging sections of versions +2, 3 and 4 and GNU extensions on top of those, though using DWARF 4 +or worst case DWARF 3 is strongly recommended. + +When not using the -m option (multifile mode), GDB CVS snapshot (soon to be +7.5) is sufficient, when using -m option, GDB from a git branch +http://sources.redhat.com/git/?p=archer.git;a=shortlog;h=refs/heads/archer-tromey-dwz-multifile +is needed. +%endif + +%if %{build_testsuite} +%description +This package contains the testsuite results from DWZ. +%endif + +%prep +%autosetup -p1 -n dwz + +cp %{SOURCE2} . +xz -d tramp3d-v4.cpp.xz + +%build +%define flags %{optflags} -O3 + +# Do PGO with tramp3d as input file +%make_build CFLAGS="%{flags} -fprofile-generate" LDFLAGS="-fprofile-generate" +g++ tramp3d-v4.cpp -O2 -g -w -o t1 +cp t1 t2 +cp t1 t3 +cp t1 t4 +./dwz -j 1 -m tmp.debug t1 t2 t3 t4 +make clean +%make_build CFLAGS="%{flags} -fprofile-use" LDFLAGS="-fprofile-use" + +%check +%if %{build_testsuite} +make -k check +%endif + +%install +%if %{build_main} +%make_install +%endif + +%if %{build_main} +%files +%license COPYING +%{_bindir}/dwz +%{_mandir}/man1/dwz.1%{?ext_man} +%endif + +%if %{build_testsuite} +%files +%defattr(-,root,root) +%doc dwz.sum +%doc dwz.log +%endif + +%changelog diff --git a/tramp3d-v4.cpp.xz b/tramp3d-v4.cpp.xz new file mode 100644 index 0000000..758f90b --- /dev/null +++ b/tramp3d-v4.cpp.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcc7c2d957b9baa4bab5eecc3ffa2e0e545ca77b00495ba158654cdee7a02d22 +size 153712 -- 2.51.1 From ae678d6214b73080aaae38da21c6311be75a7258e1ba4d7cb5a8f403949b3e61 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 12 May 2025 14:01:41 +0000 Subject: [PATCH 3/3] - Add patch (backport from upstream trunk) [swo#32934]: * dwz-fix-double-free-in-compute-abbrevs.patch OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=54 --- .gitattributes | 23 ++ .gitignore | 1 + _multibuild | 3 + dwz-0.15.tar.xz | 3 + dwz-add-support-for-version-9-gdb-index.patch | 377 ++++++++++++++++++ dwz-enable-odr-by-default.patch | 35 ++ dwz-fix-double-free-in-compute-abbrevs.patch | 63 +++ dwz-make-dejagnu-logs-more-elaborate.patch | 43 ++ ...u-test-names-environment-insensitive.patch | 110 +++++ dwz-remove-odr-struct-multifile.sh.patch | 67 ++++ dwz-rpmlintrc | 25 ++ ...tsuite-fix-finding-gdb-without-which.patch | 31 ++ dwz.changes | 294 ++++++++++++++ dwz.spec | 157 ++++++++ tramp3d-v4.cpp.xz | 3 + 15 files changed, 1235 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 dwz-0.15.tar.xz create mode 100644 dwz-add-support-for-version-9-gdb-index.patch create mode 100644 dwz-enable-odr-by-default.patch create mode 100644 dwz-fix-double-free-in-compute-abbrevs.patch create mode 100644 dwz-make-dejagnu-logs-more-elaborate.patch create mode 100644 dwz-make-dejagnu-test-names-environment-insensitive.patch create mode 100644 dwz-remove-odr-struct-multifile.sh.patch create mode 100644 dwz-rpmlintrc create mode 100644 dwz-testsuite-fix-finding-gdb-without-which.patch create mode 100644 dwz.changes create mode 100644 dwz.spec create mode 100644 tramp3d-v4.cpp.xz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..964176c --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + testsuite + diff --git a/dwz-0.15.tar.xz b/dwz-0.15.tar.xz new file mode 100644 index 0000000..3100349 --- /dev/null +++ b/dwz-0.15.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3845310e34e306747207e1038bbc4085c7e2edff8de20f7ca7f3884ca752e4 +size 150080 diff --git a/dwz-add-support-for-version-9-gdb-index.patch b/dwz-add-support-for-version-9-gdb-index.patch new file mode 100644 index 0000000..8918655 --- /dev/null +++ b/dwz-add-support-for-version-9-gdb-index.patch @@ -0,0 +1,377 @@ +From 1ae37f476bc6c9f7a756fee4830766f03600866c Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 2 Oct 2024 23:20:57 +0200 +Subject: [PATCH 4/4] Add support for version 9 .gdb_index + +Version 9 .gdb_index adds a new shortcut table. The table itself is +just two offset_type values (2 * 4 bytes) describing the language of +the main function expresses as an DW_LANG_ constant and the offset of +the main function's name in the constant pool. + +The offset to the shortcut table in the header is between the symbol +table and constant pool offsets. + +write_gdb_index explicitly copies the function's name into the new +constant pool (if lang is not zero) because it might not be an offset +to an existing name of a symbol. + +Some extra checks and warnings have been added to let the user know +when parsing the .gdb_index fails. Add a const char *file argument to +write_gdb_index for better error reporting. + +Add -D_GNU_SOURCE to Makefile CFLAGS_COMMON to use memrchr. + +This fixes the gdb-add-index.sh testcase with gdb 15+. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32146 +--- + Makefile | 2 +- + dwz.c | 180 +++++++++++++++++++++++++++++++++++++++++++------------ + 2 files changed, 144 insertions(+), 38 deletions(-) + +diff --git a/Makefile b/Makefile +index 8b7cf76..3dc6c6f 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,7 +8,7 @@ CFLAGS = -O2 -g + DWZ_VERSION := $(shell cat $(srcdir)/VERSION) + CFLAGS_VERSION = -DDWZ_VERSION='"$(DWZ_VERSION)"' + CFLAGS_COPYRIGHT = $(shell cat $(srcdir)/COPYRIGHT_YEARS) +-CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64 ++CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + XXH_PROG = "\#define XXH_INLINE_ALL 1\n\#include \n" + XXH_INLINE_ALL_WORKS = $(shell printf $(XXH_PROG) \ + | $(CC) -xc -c - -o /dev/null 2>/dev/null \ +diff --git a/dwz.c b/dwz.c +index 3bc6038..da4121f 100644 +--- a/dwz.c ++++ b/dwz.c +@@ -1,6 +1,7 @@ + /* Copyright (C) 2001-2021 Red Hat, Inc. + Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2019-2021 SUSE LLC. ++ Copyright (C) 2024 Mark J. Wielaard + Written by Jakub Jelinek , 2012. + + This program is free software; you can redistribute it and/or modify +@@ -13222,12 +13223,13 @@ gdb_index_tu_cmp (const void *p, const void *q) + /* Construct new .gdb_index section in malloced memory + if it needs adjustment. */ + static void +-write_gdb_index (void) ++write_gdb_index (const char *file) + { + dw_cu_ref cu, cu_next, first_tu = NULL; +- unsigned char *gdb_index, *ptr, *inptr, *end; ++ unsigned char *gdb_index, *ptr, *inptr, *end, *conststart; + unsigned int ncus = 0, npus = 0, ntus = 0, ndelcus = 0, ver; + unsigned int culistoff, cutypesoff, addressoff, symboloff, constoff; ++ unsigned int headersize, shortcutoff, nextoff; + unsigned int *tuindices = NULL, tuidx = 0, *cumap = NULL, i, j, k; + bool fail = false; + +@@ -13235,14 +13237,27 @@ write_gdb_index (void) + if (likely (!op_multifile) + && (debug_sections[GDB_INDEX].data == NULL + || debug_sections[GDB_INDEX].size < 0x18)) +- return; ++ { ++ if (file && debug_sections[GDB_INDEX].data != NULL) ++ error (0, 0, "%s: .gdb_index too small 0x%zx", file, ++ debug_sections[GDB_INDEX].size); ++ return; ++ } + inptr = (unsigned char *) debug_sections[GDB_INDEX].data; + if (unlikely (op_multifile)) + ver = multi_gdb_index_ver; + else + ver = buf_read_ule32 (inptr); +- if (ver < 4 || ver > 8) +- return; ++ if (ver < 4 || ver > 9) ++ { ++ if (file) ++ error (0, 0, "%s: Unknown .gdb_index section version 0x%x", file, ver); ++ return; ++ } ++ ++ /* Version 9 added a shortcut table offset (4 bytes) between the ++ address and symbol table offsets. */ ++ headersize = ver < 9 ? 0x18 : 0x1c; + + for (cu = first_cu; cu; cu = cu->cu_next) + if (cu->cu_kind == CU_PU) +@@ -13259,25 +13274,38 @@ write_gdb_index (void) + /* Starting with version 7 CU indexes are limited to 24 bits, + so if we have more CUs, give up. */ + if (npus + ncus + ntus - ndelcus >= (1U << 24)) +- return; ++ { ++ if (file) ++ error (0, 0, "%s: Cannot write %u CUs to .gdb_index", ++ file, npus + ncus + ntus - ndelcus); ++ return; ++ } + + if (unlikely (op_multifile)) + { + assert (ncus == 0 && ntus == 0); ++ /* Version 9 index contain an (empty) shortcut table of 2 32bit ++ entries (8 byte). */ + debug_sections[GDB_INDEX].new_size +- = 0x18 + npus * 16 + 16; ++ = headersize + npus * 16 + 16 + (ver >= 9 ? 8 : 0); + gdb_index = malloc (debug_sections[GDB_INDEX].new_size); + if (gdb_index == NULL) + dwz_oom (); + debug_sections[GDB_INDEX].new_data = gdb_index; + /* Write new header. */ + buf_write_le32 (gdb_index + 0x00, ver); +- buf_write_le32 (gdb_index + 0x04, 0x18); +- buf_write_le32 (gdb_index + 0x08, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x0c, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x10, 0x18 + npus * 16); +- buf_write_le32 (gdb_index + 0x14, 0x18 + npus * 16 + 16); +- ptr = gdb_index + 0x18; ++ buf_write_le32 (gdb_index + 0x04, headersize); ++ buf_write_le32 (gdb_index + 0x08, headersize + npus * 16); ++ buf_write_le32 (gdb_index + 0x0c, headersize + npus * 16); ++ buf_write_le32 (gdb_index + 0x10, headersize + npus * 16); ++ if (ver >= 9) ++ { ++ buf_write_le32 (gdb_index + 0x14, headersize + npus * 16 + 16); ++ buf_write_le32 (gdb_index + 0x18, headersize + npus * 16 + 16 + 8); ++ } ++ else ++ buf_write_le32 (gdb_index + 0x14, headersize + npus * 16 + 16); ++ ptr = gdb_index + headersize; + /* Write new CU list. */ + for (cu = first_cu; cu; cu = cu->cu_next) + { +@@ -13290,6 +13318,10 @@ write_gdb_index (void) + } + /* Write an empty hash table (with two entries). */ + memset (ptr, '\0', 16); ++ /* Write an empty shortcut table (two zero offset types, ++ indicating no main function or language). */ ++ if (ver >= 9) ++ memset (ptr + 16, '\0', 8); + return; + } + +@@ -13297,18 +13329,34 @@ write_gdb_index (void) + cutypesoff = buf_read_ule32 (inptr + 0x08); + addressoff = buf_read_ule32 (inptr + 0x0c); + symboloff = buf_read_ule32 (inptr + 0x10); +- constoff = buf_read_ule32 (inptr + 0x14); +- if (culistoff != 0x18 +- || cutypesoff != 0x18 + ncus * 16 ++ if (ver >= 9) ++ { ++ shortcutoff = buf_read_ule32 (inptr + 0x14); ++ constoff = buf_read_ule32 (inptr + 0x18); ++ nextoff = shortcutoff; ++ } ++ else ++ { ++ shortcutoff = 0; ++ constoff = buf_read_ule32 (inptr + 0x14); ++ nextoff = constoff; ++ } ++ ++ if (culistoff != headersize ++ || cutypesoff != headersize + ncus * 16 + || addressoff != cutypesoff + ntus * 24 + || symboloff < addressoff + || ((symboloff - addressoff) % 20) != 0 +- || constoff < symboloff +- || ((constoff - symboloff) & (constoff - symboloff - 1)) != 0 +- || ((constoff - symboloff) & 7) != 0 ++ || nextoff < symboloff ++ || ((nextoff - symboloff) & (nextoff - symboloff - 1)) != 0 ++ || ((nextoff - symboloff) & 7) != 0 + || debug_sections[GDB_INDEX].size < constoff) +- return; +- inptr += 0x18; ++ { ++ if (file) ++ error (0, 0, "%s: Unexpected offsets in .gdb_index", file); ++ return; ++ } ++ inptr += headersize; + if (ndelcus) + cumap = (unsigned int *) + obstack_alloc (&ob2, ncus * sizeof (unsigned int)); +@@ -13319,6 +13367,8 @@ write_gdb_index (void) + { + if (cumap) + obstack_free (&ob2, (void *) cumap); ++ if (file) ++ error (0, 0, "%s: unexpected cu cu_offset in .gdb_index", file); + return; + } + inptr += 16; +@@ -13353,6 +13403,8 @@ write_gdb_index (void) + obstack_free (&ob2, (void *) cumap); + else + obstack_free (&ob2, (void *) tuindices); ++ if (file) ++ error (0, 0, "%s: unexpected tui cu_offset in .gdb_index", file); + return; + } + } +@@ -13375,8 +13427,16 @@ write_gdb_index (void) + buf_write_le32 (gdb_index + 0x08, cutypesoff + npus * 16 - ndelcus * 16); + buf_write_le32 (gdb_index + 0x0c, addressoff + npus * 16 - ndelcus * 16); + buf_write_le32 (gdb_index + 0x10, symboloff + npus * 16 - ndelcus * 16); +- buf_write_le32 (gdb_index + 0x14, constoff + npus * 16 - ndelcus * 16); +- ptr = gdb_index + 0x18; ++ if (ver >= 9) ++ { ++ buf_write_le32 (gdb_index + 0x14, ++ shortcutoff + npus * 16 - ndelcus * 16); ++ buf_write_le32 (gdb_index + 0x18, ++ constoff + npus * 16 - ndelcus * 16); ++ } ++ else ++ buf_write_le32 (gdb_index + 0x14, constoff + npus * 16 - ndelcus * 16); ++ ptr = gdb_index + headersize; + /* Write new CU list. */ + for (cu = first_cu; cu; cu = cu_next) + { +@@ -13434,12 +13494,43 @@ write_gdb_index (void) + inptr += 20; + } + /* Copy the symbol hash table. */ +- memcpy (ptr, inptr, constoff - symboloff); ++ memcpy (ptr, inptr, nextoff - symboloff); + /* Clear the const pool initially. */ +- memset (ptr + (constoff - symboloff), '\0', ++ memset (ptr + (nextoff - symboloff) + (ver < 9 ? 0 : 8), '\0', + debug_sections[GDB_INDEX].size - constoff); ++ /* Copy the shortcut table. */ ++ if (ver >= 9) ++ { ++ unsigned char *inscptr = inptr + (nextoff - symboloff); ++ unsigned char *scptr = ptr + (nextoff - symboloff); ++ uint32_t lang = buf_read_ule32 (inscptr); ++ uint32_t name = buf_read_ule32 (inscptr + 4); ++ buf_write_le32 (scptr, lang); ++ buf_write_le32 (scptr + 4, name); ++ ++ /* If lang is not zero then put the name in the const table, it ++ might not be an offset to the name of a symbol. */ ++ if (lang != 0) ++ { ++ if (name > debug_sections[GDB_INDEX].size - constoff - 1 ++ || memrchr (debug_sections[GDB_INDEX].data ++ + debug_sections[GDB_INDEX].size, '\0', ++ debug_sections[GDB_INDEX].size ++ - constoff - name) == NULL) ++ { ++ error (0, 0, "%s: bad shortcut table name in .gdb_index", file); ++ goto fail; ++ } ++ strcpy ((char *) ptr + (constoff - symboloff) + name, ++ (char *) inptr + (constoff - symboloff) + name); ++ } ++ } + ptr = ptr + (constoff - symboloff); +- end = inptr + (constoff - symboloff); ++ end = inptr + (nextoff - symboloff); ++ if (ver >= 9) ++ conststart = end + (constoff - nextoff); ++ else ++ conststart = end; + /* Finally copy over const objects into the const pool, strings as is, + CU vectors with CU indexes adjusted. */ + while (inptr < end) +@@ -13450,9 +13541,11 @@ write_gdb_index (void) + inptr += 8; + if (name == 0 && cuvec == 0) + continue; +- if (name > debug_sections[GDB_INDEX].size - constoff - 1 +- || cuvec > debug_sections[GDB_INDEX].size - constoff - 4) ++ if (name > debug_sections[GDB_INDEX].size - nextoff - 1 ++ || cuvec > debug_sections[GDB_INDEX].size - nextoff - 4) + { ++ if (file) ++ error (0, 0, "%s: name or cuvec too large in .gdb_index", file); + fail: + free (gdb_index); + debug_sections[GDB_INDEX].new_size = 0; +@@ -13460,26 +13553,36 @@ write_gdb_index (void) + } + if (ptr[name] == '\0') + { +- unsigned char *strend = end + name; ++ unsigned char *strend = conststart + name; + while (*strend != '\0') + { + if (strend + 1 +- == end + (debug_sections[GDB_INDEX].size - constoff)) +- goto fail; ++ == conststart + (debug_sections[GDB_INDEX].size - constoff)) ++ { ++ if (file) ++ error (0, 0, "%s: name too large in .gdb_index", file); ++ goto fail; ++ } + strend++; + } +- memcpy (ptr + name, end + name, strend + 1 - (end + name)); ++ memcpy (ptr + name, conststart + name, ++ strend + 1 - (conststart + name)); + } + if (buf_read_ule32 (ptr + cuvec) == 0) + { +- unsigned int count = buf_read_ule32 (end + cuvec); ++ unsigned int count = buf_read_ule32 (conststart + cuvec); + if (count * 4 + > debug_sections[GDB_INDEX].size - constoff - cuvec - 4) +- goto fail; ++ { ++ if (file) ++ error (0, 0, "%s: count (%u) too large in .gdb_index", ++ file, count); ++ goto fail; ++ } + buf_write_le32 (ptr + cuvec, count); + for (i = 0; i < count; i++) + { +- j = buf_read_ule32 (end + cuvec + (i + 1) * 4); ++ j = buf_read_ule32 (conststart + cuvec + (i + 1) * 4); + if (ver >= 7) + k = j & ((1U << 24) - 1); + else +@@ -13506,6 +13609,9 @@ write_gdb_index (void) + obstack_free (&ob2, (void *) tuindices); + if (fail) + { ++ if (file) ++ error (0, 0, "%s: fail in .gdb_index", file); ++ + free (debug_sections[GDB_INDEX].new_data); + debug_sections[GDB_INDEX].new_data = NULL; + debug_sections[GDB_INDEX].new_size = 0; +@@ -15549,7 +15655,7 @@ dwz (const char *file, const char *outfile, struct file_result *res) + report_progress (); + fprintf (stderr, "write_gdb_index\n"); + } +- write_gdb_index (); ++ write_gdb_index (file); + /* These sections are optional and it is unclear + how to adjust them. Just remove them. */ + debug_sections[DEBUG_PUBNAMES].new_data = NULL; +@@ -15808,7 +15914,7 @@ optimize_multifile (unsigned int *die_count) + + write_abbrev (); + write_info (die_count); +- write_gdb_index (); ++ write_gdb_index (NULL); + if (write_multifile_line ()) + goto fail; + } +-- +2.43.0 + diff --git a/dwz-enable-odr-by-default.patch b/dwz-enable-odr-by-default.patch new file mode 100644 index 0000000..aafcd37 --- /dev/null +++ b/dwz-enable-odr-by-default.patch @@ -0,0 +1,35 @@ +diff --git a/args.c b/args.c +index e93c24d..3e1113f 100644 +--- a/args.c ++++ b/args.c +@@ -66,7 +66,7 @@ int gen_cu_p = 0; + + enum die_count_methods die_count_method = estimate; + +-int odr = 0; ++int odr = 1; + enum odr_mode odr_mode = ODR_LINK; + + /* Filename if inter-file size optimization should be performed. */ +@@ -202,7 +202,7 @@ static struct option_help dwz_common_options_help[] = + "Don't optimize files larger than this limit." }, + { NULL, "odr", NULL, NULL, + NULL }, +- { NULL, "no-odr", NULL, "Disabled", ++ { NULL, "no-odr", NULL, "Enabled", + "Enable/disable one definition rule optimization." }, + { NULL, "odr-mode", "", "link", + "Set aggressiveness level of one definition rule optimization." }, +diff --git a/dwz.1 b/dwz.1 +index 1cff329..f3cd3dd 100644 +--- a/dwz.1 ++++ b/dwz.1 +@@ -133,7 +133,7 @@ considered equal. This has the effect that DIEs referring to distinct DIEs + representing the same type (like f.i. pointer type DIEs) are considered equal, + and may be deduplicated. The status of this optimization is experimental. + It's disabled in low-mem mode. +-Disabled by default. ++Enabled by default. + .TP + .B \-\-odr-mode= + Set the One-Definition-Rule optimization aggressiveness: basic or link. diff --git a/dwz-fix-double-free-in-compute-abbrevs.patch b/dwz-fix-double-free-in-compute-abbrevs.patch new file mode 100644 index 0000000..f9b1e4e --- /dev/null +++ b/dwz-fix-double-free-in-compute-abbrevs.patch @@ -0,0 +1,63 @@ +From ed021b829933e5f9ee90587196ba941c30ac832a Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 12 May 2025 14:01:40 +0200 +Subject: [PATCH] Fix double free in compute_abbrevs + +PR32934 reports an abort in obstack_free after a double free. + +The relevant code is in compute_abbrevs: +... + t = (struct abbrev_tag *) + obstack_alloc (&ob2, + sizeof (*t) + + (max_nattr + 4) * sizeof (struct abbrev_attr) + + (max_nattr + 4) * sizeof (int64_t)); + ... + obstack_free (&ob2, (void *) t); + cuarr = (dw_cu_ref *) obstack_alloc (&ob2, ncus * sizeof (dw_cu_ref)); + ... + obstack_free (&ob2, (void *) t); +... + +The following happens: +- t is allocated +- t is freed +- cuarr is allocated +- t is freed. + +Usually, cuarr == t, so effectively cuarr is freed. + +But in the case of the PR, cuarr != t, so t is freed twice, triggering the +abort. + +Fix this by freeing cuarr instead. + +Tested on x86_64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32934 + +2025-05-12 Tom de Vries + + * dwz.c (compute_abbrevs): Free cuarr instead of double-freeing t. +--- + dwz.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dwz.c b/dwz.c +index da4121f..a27eb4d 100644 +--- a/dwz.c ++++ b/dwz.c +@@ -11813,7 +11813,7 @@ compute_abbrevs (DSO *dso) + } + obstack_free (&ob2, (void *) arr); + } +- obstack_free (&ob2, (void *) t); ++ obstack_free (&ob2, (void *) cuarr); + for (cu = first_cu; cu; cu = cu->cu_next) + { + struct abbrev_tag **arr; + +base-commit: 1ae37f476bc6c9f7a756fee4830766f03600866c +-- +2.43.0 + diff --git a/dwz-make-dejagnu-logs-more-elaborate.patch b/dwz-make-dejagnu-logs-more-elaborate.patch new file mode 100644 index 0000000..4ca939b --- /dev/null +++ b/dwz-make-dejagnu-logs-more-elaborate.patch @@ -0,0 +1,43 @@ +From 5ae6047adef9648f50e007b23df09d38de5e0729 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Sat, 18 Feb 2023 12:36:15 +0100 +Subject: [PATCH 1/4] make dejagnu logs more elaborate + +dwz-tests.exp produces totally barebones dwz.log files, basically +duplicating the .sum file. If there are any errors, there's +basically no info to go on. + +The patch runs the .sh subtests in -x trace mode, and logs +stdout/stderr to the .log file, so e.g. bunsen can safe-keep it. +Otherwise I believe no-op. +--- + testsuite/dwz.tests/dwz-tests.exp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 811767f..85e6fcd 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -116,16 +116,17 @@ foreach test $tests { + exec mkdir $dir + + cd $dir +- if { [catch { exec sh -e $test } msg] } { ++ if { [catch { exec sh -x -e $test 2>@1 } msg] } { ++ verbose -log "$msg" + if { [lindex $::errorCode 0] == "CHILDSTATUS" && \ + [lindex $::errorCode 2] == 77 } { + unsupported "$test" + exec rm -Rf $dir + } else { +- puts "$msg" + fail "$test" + } + } else { ++ verbose -log "$msg" + if { [file exists dwz.info ] } { + set info [exec cat dwz.info] + verbose -log "$test:" 1 +-- +2.43.0 + diff --git a/dwz-make-dejagnu-test-names-environment-insensitive.patch b/dwz-make-dejagnu-test-names-environment-insensitive.patch new file mode 100644 index 0000000..31945c6 --- /dev/null +++ b/dwz-make-dejagnu-test-names-environment-insensitive.patch @@ -0,0 +1,110 @@ +From 9621200e66f0339da5a80e1abf46f4789a4a3690 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Wed, 1 Mar 2023 16:51:58 +0100 +Subject: [PATCH 2/4] make dejagnu test names environment-insensitive + +Previous versions of dwz-tests.exp emit the full path names to the +per-test .sh scripts into the .sum/.log files. This version replaces +those patn names with just the $basename, which is enough to identify +the tests uniquely, and allows proper regression/comparison analysis. + +https://sourceware.org/bugzilla/show_bug.cgi?id=30182 +--- + testsuite/dwz.tests/dwz-tests.exp | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 85e6fcd..20affea 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -27,20 +27,20 @@ foreach test $tests { + if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } { + # Some error occurred in the supported test, f.i. DWARF in min + # unsupported by readelf. +- unsupported "$test" ++ unsupported $basename + continue + } + if { $matches != 2 } { + # The exec min is used for the regression test for pr24341, but it + # only functions as such if the DWARF only contains the CUs of the + # test-case itself. +- unsupported "$test" ++ unsupported $basename + continue + } + } + if { $basename == "pr24172.sh" } { + if { ![istarget x86_64-*-*] } { +- unsupported "$test" ++ unsupported $basename + continue + } + lappend required_execs "dw2-skip-prologue" +@@ -62,17 +62,17 @@ foreach test $tests { + } + if { ![istarget x86_64-*-*] } { + if { $basename == "pr24468.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + if { $basename == "ld-2.26.1-multifile.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + } + if { $basename == "gdb-add-index.sh" } { + if { [catch { exec which gdb-add-index } ] } { +- unsupported "$test" ++ unsupported $basename + continue + } + } +@@ -82,7 +82,7 @@ foreach test $tests { + if { $basename == "eu-strip-unstrip.sh" || \ + $basename == "eu-strip-unstrip-multifile.sh" || \ + $basename == "pr24173.sh" } { +- unsupported "$test" ++ unsupported $basename + continue + } + } +@@ -107,7 +107,7 @@ foreach test $tests { + } + } + if { $unsupported == 1 } { +- unsupported "$test" ++ unsupported $basename + continue + } + +@@ -120,10 +120,10 @@ foreach test $tests { + verbose -log "$msg" + if { [lindex $::errorCode 0] == "CHILDSTATUS" && \ + [lindex $::errorCode 2] == 77 } { +- unsupported "$test" ++ unsupported $basename + exec rm -Rf $dir + } else { +- fail "$test" ++ fail $basename + } + } else { + verbose -log "$msg" +@@ -136,9 +136,9 @@ foreach test $tests { + set file_list [glob -nocomplain "$dir/*"] + if {[llength $file_list] != 0} { + puts "$dir is not empty" +- fail "$test" ++ fail $basename + } else { +- pass "$test" ++ pass $basename + exec rm -Rf $dir + } + } +-- +2.43.0 + diff --git a/dwz-remove-odr-struct-multifile.sh.patch b/dwz-remove-odr-struct-multifile.sh.patch new file mode 100644 index 0000000..705fab4 --- /dev/null +++ b/dwz-remove-odr-struct-multifile.sh.patch @@ -0,0 +1,67 @@ +diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh +deleted file mode 100755 +index 5961abf..0000000 +--- a/testsuite/dwz.tests/odr-struct-multifile.sh ++++ /dev/null +@@ -1,61 +0,0 @@ +-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 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 2 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true) +- case $name in +- member_one|member_two) +- [ $cnt -eq 2 ] +- ;; +- member_three|member_four) +- [ $cnt -eq 1 ] +- ;; +- esac +-done +- +-decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true) +- +-$execs/dwz-for-test --odr 1 2 -m 3 +- +-verify-dwarf.sh 1 +-verify-dwarf.sh 3 +- +-for name in aaa bbb ccc; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-for name in member_one member_two member_three member_four; do +- cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 1 ] +-done +- +-# Even with -wN readelf 2.38-15.fc37 follows and prints the contents +-# of the alt file. So make sure it cannot do that by removing it. +-rm 3 +- +-for name in aaa bbb ccc; do +- 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 $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true) +- [ $cnt -eq 0 ] +-done +- +-rm -f 1 2 3 diff --git a/dwz-rpmlintrc b/dwz-rpmlintrc new file mode 100644 index 0000000..d65bb5d --- /dev/null +++ b/dwz-rpmlintrc @@ -0,0 +1,25 @@ +# The package should _not_ be noarch, testresults differ from architecture +# to architecture. +addFilter("dwz-testsuite.* no-binary") + +# The rpmlint warning is: +# dwz-testsuite.nosrc: W: invalid-spec-name +# The spec file name (without the .spec suffix) must match the package name +# ("Name:" tag). Either rename your package or the specfile. +# This seems to be a multibuild artifact. The package name is dwz-testsuite, +# but the specfile filename is dwz.spec. The only way we can fix this is by +# reverting to a two-specfile setup. +# +# FTR, the warning comes paired with these grep failures in the "Preparing +# packages log": +# ... testing for empty debuginfo packages +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# ... running 50-check-filelist +# ... +# ... testing devel dependencies required by libtool .la files +# grep: SOURCES/dwz-testsuite.spec: No such file or directory +# (can be skipped by "skip-check-libtool-deps" anywhere in spec) +# ... running 50-check-packaged-twice +# +# So, skip the rpmlint warning. This doesn't fix the grep fails. +addFilter("dwz-testsuite.* invalid-spec-name") diff --git a/dwz-testsuite-fix-finding-gdb-without-which.patch b/dwz-testsuite-fix-finding-gdb-without-which.patch new file mode 100644 index 0000000..5e4597a --- /dev/null +++ b/dwz-testsuite-fix-finding-gdb-without-which.patch @@ -0,0 +1,31 @@ +From 0171f3e7ac09fa44cb1eb299f2703faa113a207e Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sat, 27 Jul 2024 15:07:56 +0100 +Subject: [PATCH 3/4] testsuite: fix finding gdb without `which` + +which isn't considered portable. Some Linux distributions like Debian and +Gentoo are seeking to remove it from their base set of packages [0]. + +Use POSIX's `command -v` instead. + +[0] https://lwn.net/Articles/874049/ +--- + testsuite/dwz.tests/dwz-tests.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp +index 20affea..8e407d4 100644 +--- a/testsuite/dwz.tests/dwz-tests.exp ++++ b/testsuite/dwz.tests/dwz-tests.exp +@@ -71,7 +71,7 @@ foreach test $tests { + } + } + if { $basename == "gdb-add-index.sh" } { +- if { [catch { exec which gdb-add-index } ] } { ++ if { [catch { exec sh -c "command -v gdb-add-index" } ] } { + unsupported $basename + continue + } +-- +2.43.0 + diff --git a/dwz.changes b/dwz.changes new file mode 100644 index 0000000..b63246a --- /dev/null +++ b/dwz.changes @@ -0,0 +1,294 @@ +------------------------------------------------------------------- +Mon May 12 13:54:07 UTC 2025 - Tom de Vries + +- Add patch (backport from upstream trunk) [swo#32934]: + * dwz-fix-double-free-in-compute-abbrevs.patch + +------------------------------------------------------------------- +Tue Mar 4 08:30:59 UTC 2025 - Tom de Vries + +- Add patch (backport from upstream trunk): + * dwz-add-support-for-version-9-gdb-index.patch + * dwz-make-dejagnu-logs-more-elaborate.patch + * dwz-make-dejagnu-test-names-environment-insensitive.patch + * dwz-testsuite-fix-finding-gdb-without-which.patch +- Drop patch: + * dwz-remove-odr-struct-multifile.sh.patch + +------------------------------------------------------------------- +Fri Dec 20 07:47:14 UTC 2024 - Martin Hauke + +- Use %{SOURCE2} macro instead of hardcoding the source file name/path. + This makes the spec file compatible with rpmbuild. + +------------------------------------------------------------------- +Mon Feb 26 08:07:43 UTC 2024 - Dominique Leuenberger + +- Use %autosetup macro. Allows to eliminate the usage of deprecated + PatchN. + +------------------------------------------------------------------- +Sun Nov 20 16:04:19 UTC 2022 - Bernhard Wiedemann + +- Make PGO training independent from number of build machine cores + (boo#1040589) + +------------------------------------------------------------------- +Mon Nov 7 08:09:38 UTC 2022 - Martin Liška + +- Update to 0.15 release: + * Uses xxHash hashing algorithm. A 8% ~ 14% speedup. + * Set endianity of multifile using -e, --multifile-endian. + * Set pointer size of multifile using -p, --multifile-pointer-size + * Process files in parallel using -j N --jobs N. The default is + processors / 2. Disabled when multifile is used. + * Prints abbrev or DIE offset for Unknown DWARF error messages. + * All testcases have been updated to work against the binutils 2.39. +- Remove upstreamed patches: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + * dwz-use-grep-E-instead-of-egrep.patch +- Rebased patches: + * dwz-remove-odr-struct-multifile.sh.patch + * dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Thu Sep 8 17:53:27 UTC 2022 - Martin Liška + +- Add dwz-use-grep-E-instead-of-egrep.patch in order + to fix build with latest grep package. + +------------------------------------------------------------------- +Thu Apr 28 10:08:03 UTC 2022 - Martin Liška + +- Drop binutils-gold dependency for testsuite as binutils-gold + is deprecated and will be removed in the future. + +------------------------------------------------------------------- +Wed Feb 2 09:20:10 UTC 2022 - Martin Liška + +- Silent warnings for tramp3d compilation. + +------------------------------------------------------------------- +Wed Jan 5 06:20:01 UTC 2022 - Martin Liška + +- Add dwz-remove-odr-struct-multifile.sh.patch that removes problematic + testcase. + +------------------------------------------------------------------- +Thu Dec 23 10:59:49 UTC 2021 - Martin Liška + +- Start using -O3 and PGO with tramp3d as training binary. + +------------------------------------------------------------------- +Wed Mar 17 15:54:22 UTC 2021 - Tom de Vries + +- Backport fixes for odr PR [swo#27578]: + * dwz-fix-another-reference-from-pu-to-cu-for-odr.patch + * dwz-handle-reordered-dup-chains-in-create-import-tree.patch +- Backport testsuite fix: + * dwz-testsuite-fix-pr27463.sh-on-riscv64.patch + +------------------------------------------------------------------- +Wed Mar 17 15:38:20 UTC 2021 - Tom de Vries + +- DWZ 0.14 update: + * Dropped patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + - dwz-update-suse-copyright-years.patch + - dwz-update-version.patch + * Updated patch: + - dwz-enable-odr-by-default.patch + +------------------------------------------------------------------- +Fri Feb 26 12:07:30 UTC 2021 - Tom de Vries + +- Change Version tag from 0.14rc1 to 0.14~rc1 + * Rename dwz-0.14rc1.tar.xz to dwz-0.14~rc1.tar.xz + +------------------------------------------------------------------- +Fri Feb 26 09:31:00 UTC 2021 - Tom de Vries + +- Fix testsuite build fail on riscv64: + * dwz-testsuite-fix-pr25109.sh-on-riscv64.patch + +------------------------------------------------------------------- +Fri Feb 26 08:38:53 UTC 2021 - Tom de Vries + +- Update reported dwz version + * dwz-update-version.patch + +------------------------------------------------------------------- +Fri Feb 26 07:52:22 UTC 2021 - Tom de Vries + +- DWZ 0.14-rc1 (master branch commit 0d391bf) update: + * Dropped patches: + - dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + - dwz-fix-die-no-multifile-propagation.patch + - dwz-fix-refd-NULL-assertion-in-write_die.patch + - dwz-fix-reference-from-pu-to-cu.patch + - dwz-fix-segfault-in-die_cu.patch + - dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + - dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + - dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + - dwz-update-version-copyright-message.patch + * Added patches: + - dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch + - dwz-call-reorder_dups-asap.patch + - dwz-document-experimental-status-of-odr.patch + - dwz-enable-odr-by-default.patch + - dwz-fix-reference-of-pu-to-cu-for-odr.patch + - dwz-precompute-partitions.patch + - dwz-update-suse-copyright-years.patch + * Added BuildRequires gcc-c++ +------------------------------------------------------------------- +Thu Jan 7 10:21:31 UTC 2021 - Tom de Vries + +- Fix pr24468.sh test-case with newer readelf. + * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + +------------------------------------------------------------------- +Thu Jan 7 09:15:48 UTC 2021 - Tom de Vries + +- Detect when devel-ignore-size.sh is unsupported [swo#27115]. + * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + +------------------------------------------------------------------- +Wed Aug 5 08:16:04 UTC 2020 - Tom de Vries + +- Fix error: source 0 defined multiple times. + +------------------------------------------------------------------- +Wed Aug 5 08:00:30 UTC 2020 - Tom de Vries + +- Silence warning "dwz-rpmlintrc is not mentioned in spec files". + +------------------------------------------------------------------- +Wed Aug 5 06:49:52 UTC 2020 - Tom de Vries + +- Add dwz-rpmlintrc. Add comment to NoSource directive. + +------------------------------------------------------------------- +Fri Jan 24 17:08:55 UTC 2020 - Tom de Vries + +- Fix segfault in die_cu [swo#25456]. + * dwz-fix-segfault-in-die_cu.patch + +------------------------------------------------------------------- +Fri Jan 17 06:30:58 UTC 2020 - Tom de Vries + +- Fix reference from compilation unit to partial unit [swo#25398]. + * dwz-fix-reference-from-pu-to-cu.patch + +------------------------------------------------------------------- +Thu Nov 28 12:56:34 UTC 2019 - Tom de Vries + +- Fix assertion failure 'refd != NULL' in write_die [swo#24169]. + * dwz-fix-refd-NULL-assertion-in-write_die.patch + +------------------------------------------------------------------- +Wed Nov 27 18:50:07 UTC 2019 - Tom de Vries + +- Fix assertion failure 'off == cu_size' in recompute_abbrevs + [swo#24764]. + * dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch + +------------------------------------------------------------------- +Tue Nov 5 09:55:50 UTC 2019 - Tom de Vries + +- Fix die_no_multifile propagation [swo#25109]. + * dwz-fix-die-no-multifile-propagation.patch + +------------------------------------------------------------------- +Wed Aug 28 12:47:09 UTC 2019 - Tom de Vries + +- Disable dwz:testsuite if %{with ringdisabled} + +------------------------------------------------------------------- +Fri Aug 16 11:26:06 UTC 2019 - Tom de Vries + +- Fix copyright years in --version message: + * dwz-update-version-copyright-message.patch + +------------------------------------------------------------------- +Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries + +- Split off dwz-testsuite package using multibuild, to remove build + cycle +- Don't require binutils-gold for riscv64 + +------------------------------------------------------------------- +Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries + +- DWZ 0.13 update: + * Dropped patches: + - dwz-0.12-ignore-nobits.patch + - dwz-0.12-DW_OP_GNU_variable_value.patch + - dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + * Added BuildRequires for dejagnu, elfutils, gdb and binutils-gold. + * Add %check +- Add URL tag + +------------------------------------------------------------------- +Mon Feb 18 14:31:42 UTC 2019 - tdevries@suse.com + +- Add dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + to fix assert on cc1 binary from gcc bootstrap-lto [swo#24195]. + +------------------------------------------------------------------- +Wed Apr 11 11:02:06 UTC 2018 - rguenther@suse.com + +- Add dwz-0.12-DW_OP_GNU_variable_value.patch to handle + DW_OP_GNU_variable_value. + +------------------------------------------------------------------- +Wed Mar 14 13:32:56 UTC 2018 - mliska@suse.cz + +- Run spec-cleaner on the package. + +------------------------------------------------------------------- +Tue Mar 7 09:57:14 UTC 2017 - rguenther@suse.com + +- Adjust dwz-0.12-ignore-nobits.patch to also handle non-monotonically + increasing sh_offset as created by the kernel linker script. + +------------------------------------------------------------------- +Tue Feb 21 13:35:26 UTC 2017 - rguenther@suse.com + +- Add dwz-0.12-ignore-nobits.patch to ignore SHT_NOBITS sections + that are placed out-of-order by objcopy when extracting debuginfo + and place them at sh_offset zero. + +------------------------------------------------------------------- +Tue Nov 29 08:51:04 UTC 2016 - rguenther@suse.com + +- Update to new upstream version 0.12 +* Fix up alignment of non-allocated sections and section header table + after sections which have changed size. + +------------------------------------------------------------------- +Wed Dec 10 15:38:40 UTC 2014 - jengelh@inai.de + +- Update to new upstream version 0.11 +* fix iterative hashing on big-endian targets +* optimize DW_FORM_data[48] DW_AT_high_pc that GCC 4.8 produces +* fix up handling of DIE equality if more than one DIE in the same + CU compare equal +* check DW_FORM_ref_addr properly during fi_multifile phase +* when creating DW_AT_stmt_list, use DW_FORM_sec_offset for dwarf4 + and DW_FORM_data4 for dwarf[23] rather than vice versa +* handle .gdb_index version 7 and 8 + +------------------------------------------------------------------- +Wed Jun 27 14:04:01 CEST 2012 - pth@suse.de + +- Initial package + + diff --git a/dwz.spec b/dwz.spec new file mode 100644 index 0000000..748038e --- /dev/null +++ b/dwz.spec @@ -0,0 +1,157 @@ +# +# spec file for package dwz +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define flavor @BUILD_FLAVOR@%{nil} + +%bcond_with ringdisabled + +%if "%flavor" == "testsuite" +%if %{with ringdisabled} +ExclusiveArch: do_not_build +%endif +%define build_main 0 +%define build_testsuite 1 +%else +%define build_main 1 +%define build_testsuite 0 +%endif + +%if %{build_testsuite} +%define debug_package %{nil} +%endif + +%if %{build_main} +%define name_suffix %{nil} +%else +%define name_suffix -%{flavor} +%endif + +Name: dwz%{name_suffix} +Version: 0.15 +Release: 0 +%if %{build_main} +Summary: DWARF optimization and duplicate removal tool +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +%if %{build_testsuite} +Summary: Testsuite results from DWZ +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building +%endif +#Git-Clone: git://sourceware.org/git/dwz +#Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary +Source: dwz-%{version}.tar.xz +URL: https://sourceware.org/dwz/ +BuildRequires: gcc-c++ +BuildRequires: libelf-devel +BuildRequires: xxhash-devel +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: dejagnu +BuildRequires: elfutils +BuildRequires: gdb +%endif + +%if !%{build_main} +# It's a bit pointless to ship two identical source packages, one for dwz and +# one for dwz-testsuite. So we make the second one small by excluding the +# source archive. We could do the same for the patches with NoPatch, but the +# gain is smaller there and looks more cumbersome to maintain. +NoSource: 0 +%endif + +Source1: dwz-rpmlintrc +Source2: tramp3d-v4.cpp.xz + +Patch1: dwz-enable-odr-by-default.patch +Patch3: dwz-make-dejagnu-logs-more-elaborate.patch +Patch4: dwz-make-dejagnu-test-names-environment-insensitive.patch +Patch5: dwz-testsuite-fix-finding-gdb-without-which.patch +Patch6: dwz-add-support-for-version-9-gdb-index.patch +Patch7: dwz-fix-double-free-in-compute-abbrevs.patch + +%if %{build_main} +%description +dwz optimizes DWARF debugging information contained in ELF shared +libraries and executables for size, by replacing DWARF information +representation with equivalent smaller representation where possible, +and by reducing the amount of duplication using techniques from the +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. + +The tool handles DWARF 32-bit format debugging sections of versions +2, 3 and 4 and GNU extensions on top of those, though using DWARF 4 +or worst case DWARF 3 is strongly recommended. + +When not using the -m option (multifile mode), GDB CVS snapshot (soon to be +7.5) is sufficient, when using -m option, GDB from a git branch +http://sources.redhat.com/git/?p=archer.git;a=shortlog;h=refs/heads/archer-tromey-dwz-multifile +is needed. +%endif + +%if %{build_testsuite} +%description +This package contains the testsuite results from DWZ. +%endif + +%prep +%autosetup -p1 -n dwz + +cp %{SOURCE2} . +xz -d tramp3d-v4.cpp.xz + +%build +%define flags %{optflags} -O3 + +# Do PGO with tramp3d as input file +%make_build CFLAGS="%{flags} -fprofile-generate" LDFLAGS="-fprofile-generate" +g++ tramp3d-v4.cpp -O2 -g -w -o t1 +cp t1 t2 +cp t1 t3 +cp t1 t4 +./dwz -j 1 -m tmp.debug t1 t2 t3 t4 +make clean +%make_build CFLAGS="%{flags} -fprofile-use" LDFLAGS="-fprofile-use" + +%check +%if %{build_testsuite} +make -k check +%endif + +%install +%if %{build_main} +%make_install +%endif + +%if %{build_main} +%files +%license COPYING +%{_bindir}/dwz +%{_mandir}/man1/dwz.1%{?ext_man} +%endif + +%if %{build_testsuite} +%files +%defattr(-,root,root) +%doc dwz.sum +%doc dwz.log +%endif + +%changelog diff --git a/tramp3d-v4.cpp.xz b/tramp3d-v4.cpp.xz new file mode 100644 index 0000000..758f90b --- /dev/null +++ b/tramp3d-v4.cpp.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcc7c2d957b9baa4bab5eecc3ffa2e0e545ca77b00495ba158654cdee7a02d22 +size 153712 -- 2.51.1