SHA256
1
0
forked from pool/dwz

Accepting request 1034029 from devel:tools:compiler

- 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

OBS-URL: https://build.opensuse.org/request/show/1034029
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dwz?expand=0&rev=21
This commit is contained in:
Dominique Leuenberger 2022-11-09 11:55:51 +00:00 committed by Git OBS Bridge
commit 603677bdae
10 changed files with 63 additions and 311 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:87ea6f138bdb85b8ef37883e97b04e329fae56302a49cfd41c267d1f53fe6e0f
size 147428

BIN
dwz-0.15.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,39 +1,17 @@
Enable odr by default
This reverts commit d49096d "[odr] Disable --odr by default".
---
dwz.1 | 2 +-
dwz.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dwz.1 b/dwz.1
index 19dc814..63c50d5 100644
--- a/dwz.1
+++ b/dwz.1
@@ -119,7 +119,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=<basic|link>
Set the One-Definition-Rule optimization aggressiveness: basic or link.
diff --git a/dwz.c b/dwz.c
index 5effbc1..a02b8fd 100644
--- a/dwz.c
+++ b/dwz.c
@@ -230,7 +230,7 @@ enum die_count_methods
};
static enum die_count_methods die_count_method = estimate;
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_BASIC, ODR_LINK };
enum odr_mode odr_mode = ODR_LINK;
int odr_mode_parsed = 0;
@@ -16343,7 +16343,7 @@ static struct option_help dwz_common_options_help[] =
/* 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 },
@ -42,3 +20,16 @@ index 5effbc1..a02b8fd 100644
"Enable/disable one definition rule optimization." },
{ NULL, "odr-mode", "<basic|link>", "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=<basic|link>
Set the One-Definition-Rule optimization aggressiveness: basic or link.

View File

@ -1,82 +0,0 @@
Fix another reference from PU to CU for odr
[ Backport of master commit f765cd9. ]
When using the test-case from PR27578 with --no-import-optimize, we run into:
...
$ dwz libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z \
-lnone --odr --no-import-optimize
dwz: dwz.c:12700: write_die: \
Assertion `IMPLIES (cu->cu_kind == CU_PU, \
die_cu (refd)->cu_kind == CU_PU)' failed.
Aborted (core dumped)
...
The assert is triggered when trying to write out the reference to the DIE at
2f5e for DW_AT_type:
...
<1><2e8c>: Abbrev Number: 76 (DW_TAG_structure_type)
<2e8d> DW_AT_name : (indirect string, offset: 0x5f592): SalXLib
<2e91> DW_AT_byte_size : 320
...
<2><2ed9>: Abbrev Number: 22 (DW_TAG_member)
<2eda> DW_AT_name : (indirect string, offset: 0x56c9b): aReadFDS_
<2ede> DW_AT_decl_file : 33
<2edf> DW_AT_decl_line : 173
<2ee0> DW_AT_decl_column : 21
<2ee1> DW_AT_type : <0x2f5e>
<2ee5> DW_AT_data_member_location: 48
<2ee6> DW_AT_accessibility: 2 (protected)
...
The corresponding duplicate chain (with some annotations manually added) is:
...
duplicate chain:
Compilation Unit @ offset 0x44:
2d01 O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL
2e8c O 9f6a4268(87d059e8) 9f6a4268 SalXLib structure_type DEF
40a6 O 9f6a4268(87d059e8) 9f6a4268 SalXLib structure_type DEF
Compilation Unit @ offset 0xfaf6:
419be O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL
50e56 O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL
6063a O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL
Compilation Unit @ offset 0x1bb0f:
...
The duplicate chain is created by split_dups, which merged all the DECLs with
one duplicate chain containing only DEFs.
When doing the test for merged_singleton on this duplicate chain, it returns
NULL, because there are two DEFs. However, the DEFs are from the same CU, and
the type for aReadFDS_ is 0x2f5e for both DEFs. Consequently, there is no
duplicate chain for 0x2f5e, and we need to force a singleton duplicate chain.
Fix this by making merged_singleton return the first DEF.
2021-03-16 Tom de Vries <tdevries@suse.de>
PR dwz/27578
* dwz.c (merged_singleton): Handle DEFs in the same CU.
---
dwz.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dwz.c b/dwz.c
index 5effbc1..fb7fbb1 100644
--- a/dwz.c
+++ b/dwz.c
@@ -8378,7 +8378,12 @@ merged_singleton (dw_die_ref die)
{
case ODR_DEF:
if (res)
- return NULL;
+ {
+ if (die_cu (res) == die_cu (d))
+ continue;
+ else
+ return NULL;
+ }
else
res = d;
break;

View File

@ -1,107 +0,0 @@
Handle reordered dup chains in create_import_tree
[ Backport of master commit 4e7ce44. ]
With the test-case from PR27578, we run into:
...
$ dwz libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z \
-lnone --odr --devel-progress
create_import_tree phase 2
dwz: dwz.c:8833: remove_import_edges: Assertion `i == cucount' failed.
Aborted (core dumped)
...
Using --devel-verify-edges, we can trigger an assert earlier:
...
create_import_tree phase 1
dwz: dwz.c:8923: verify_edges_1: \
Assertion `count == 0 || e1->icu->idx > last_idx' failed.
Aborted (core dumped)
...
where e1->icu->idx == 201 and last_idx == 201.
The problem is (as we can see using --devel-dump-edges) that there's a
duplicate edge from CU 201 to PU 48:
...
idx: 48
cu: 0xbc
incoming: 200
incoming: 201
incoming: 201
incoming: 203
incoming: 204
incoming: 208
...
This can be traced back to this duplicate chain:
...
duplicate chain:
7fe2 O 2de8b1f3(fc1aa040) 2de8b1f3 Visual structure_type DECL
19d67 O 2de8b1f3(fc1aa040) 2de8b1f3 Visual structure_type DECL
2a7aa O 2de8b1f3(fc1aa040) 2de8b1f3 Visual structure_type DECL
41434 O 2de8b1f3(fc1aa040) 2de8b1f3 Visual structure_type DECL
Compilation Unit @ offset 0x5bf84:
5fd9d O 2de8b1f3(fc1aa040) 2de8b1f3 Visual structure_type DECL
611f5 O 2de8b1f3(deb4b00f) 2de8b1f3 Visual structure_type DEF
...
Since it starts with a DECL, it will be reordered such that the DEF is at
the start. However, that breaks the code in create_import_tree that checks
for duplicate chain members from the same CU, which assumes that those are
adjacent.
Fix this in create_import_tree.
2021-03-16 Tom de Vries <tdevries@suse.de>
PR dwz/27578
* dwz.c (create_import_tree): Handle reorder duplicate chain.
---
dwz.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dwz.c b/dwz.c
index fb7fbb1..481674f 100644
--- a/dwz.c
+++ b/dwz.c
@@ -9080,11 +9080,18 @@ create_import_tree (void)
ipu->cu = pu;
pu->u1.cu_icu = ipu;
assert (rdie->die_toplevel);
+ dw_die_ref firstdie = NULL;
+ dw_cu_ref firstdiecu = NULL;
for (die = rdie->die_nextdup, prev_cu = NULL;
die; die = die->die_nextdup)
{
dw_cu_ref diecu = die_cu (die);
- if (diecu == prev_cu)
+ if (firstdie == NULL)
+ {
+ firstdie = die;
+ firstdiecu = die_cu (firstdie);
+ }
+ if (diecu == prev_cu || (die != firstdie && diecu == firstdiecu))
continue;
ipu->incoming_count++;
size += 1 + (diecu->cu_version == 2 ? ptr_size : 4);
@@ -9094,11 +9101,18 @@ create_import_tree (void)
obstack_alloc (&ob2,
ipu->incoming_count
* sizeof (*ipu->incoming));
+ firstdie = NULL;
+ firstdiecu = NULL;
for (die = rdie->die_nextdup, i = 0, prev_cu = NULL;
die; die = die->die_nextdup)
{
dw_cu_ref diecu = die_cu (die);
- if (diecu == prev_cu)
+ if (firstdie == NULL)
+ {
+ firstdie = die;
+ firstdiecu = die_cu (firstdie);
+ }
+ if (diecu == prev_cu || (die != firstdie && diecu == firstdiecu))
continue;
icu = diecu->u1.cu_icu;
if (icu == NULL)

View File

@ -1,13 +1,18 @@
diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
deleted file mode 100644
index cc462c9..0000000
deleted file mode 100755
index 5961abf..0000000
--- a/testsuite/dwz.tests/odr-struct-multifile.sh
+++ /dev/null
@@ -1,53 +0,0 @@
@@ -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
-
@ -45,14 +50,17 @@ index cc462c9..0000000
- [ $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 1 | grep -c "DW_AT_name.*:.*$name" || true)
- cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
- [ $cnt -eq 0 ]
-done
-
-for name in member_one member_two member_three member_four; do
- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
- cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
- [ $cnt -eq 0 ]
-done
-

View File

@ -1,39 +0,0 @@
[testsuite] Fix pr27463.sh on riscv64
On riscv64, I run into:
...
cc main.c unavailable-dwarf-piece-dw.S -o unavailable-dwarf-piece
unavailable-dwarf-piece-dw.S: Assembler messages:
unavailable-dwarf-piece-dw.S:24: Error: non-constant .uleb128 is not supported
...
make: *** [Makefile:100: unavailable-dwarf-piece] Error 1
...
Fix this similar to commit 53c0488 "[testsuite] Fix pr25109.sh on riscv64".
2021-03-17 Tom de Vries <tdevries@suse.de>
* Makefile (no-multifile-prop): Allow target rule to fail.
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 2f7c76a..2990567 100644
--- a/Makefile
+++ b/Makefile
@@ -96,11 +96,11 @@ $(TEMP_ASM_FILES): %-dw.S: $(TEST_SRC)/../lib/%.exp
export DEJAGNU=$(DEJAGNU); \
runtest --tool=dwz -srcdir $(srcdir)/testsuite/ lib/$*.exp
-$(filter-out no-multifile-prop, $(TEST_EXECS_DWARF_ASM)): %: %-dw.S
+$(filter-out no-multifile-prop unavailable-dwarf-piece, $(TEST_EXECS_DWARF_ASM)): %: %-dw.S
$(CC) $(TEST_SRC)/main.c $< -o $@
# Fails to compile on riscv64: Error: non-constant .uleb128 is not supported.
-no-multifile-prop: %: %-dw.S
+no-multifile-prop unavailable-dwarf-piece: %: %-dw.S
$(CC) $(TEST_SRC)/main.c $< -o $@ || true
odr-struct:

View File

@ -1,32 +0,0 @@
From a57177980a05f0f84bf290ab7b68f73c0f78053f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Li=C5=A1ka?= <mliska@suse.cz>
Date: Wed, 7 Sep 2022 21:55:03 +0200
Subject: [PATCH] Use grep -E instead of egrep.
egrep is obsoleted starting with GNU Grep 3.8.
diff --git a/contrib/bytes-per-die.sh b/contrib/bytes-per-die.sh
index 969f733..fda8998 100755
--- a/contrib/bytes-per-die.sh
+++ b/contrib/bytes-per-die.sh
@@ -3,7 +3,7 @@
f="$1"
size=$(readelf -WS "$f" \
- | egrep "[ \t]\.debug_info" \
+ | grep -E "[ \t]\.debug_info" \
| sed 's/.*\.debug_info//' \
| awk '{print $4}')
size=$((16#$size))
diff --git a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
index 7f1e174..71d8518 100644
--- a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
+++ b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
@@ -7,7 +7,7 @@ $execs/dwz-for-test \
1 2 \
2> dwz.err
-if egrep -q "Compressing (1|2)$" dwz.err; then
+if grep -Eq "Compressing (1|2)$" dwz.err; then
exit 1
fi

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Mon Nov 7 08:09:38 UTC 2022 - Martin Liška <mliska@suse.cz>
- 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 <mliska@suse.cz>

View File

@ -42,7 +42,7 @@ ExclusiveArch: do_not_build
%endif
Name: dwz%{name_suffix}
Version: 0.14
Version: 0.15
Release: 0
%if %{build_main}
Summary: DWARF optimization and duplicate removal tool
@ -60,6 +60,7 @@ 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
@ -78,12 +79,8 @@ NoSource: 0
Source1: dwz-rpmlintrc
Source2: tramp3d-v4.cpp.xz
Patch1: dwz-fix-another-reference-from-pu-to-cu-for-odr.patch
Patch2: dwz-handle-reordered-dup-chains-in-create-import-tree.patch
Patch3: dwz-enable-odr-by-default.patch
Patch4: dwz-testsuite-fix-pr27463.sh-on-riscv64.patch
Patch5: dwz-remove-odr-struct-multifile.sh.patch
Patch6: dwz-use-grep-E-instead-of-egrep.patch
Patch1: dwz-enable-odr-by-default.patch
Patch2: dwz-remove-odr-struct-multifile.sh.patch
%if %{build_main}
%description
@ -114,10 +111,6 @@ This package contains the testsuite results from DWZ.
%setup -q -n dwz
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
cp ../../SOURCES/tramp3d-v4.cpp.xz .
xz -d tramp3d-v4.cpp.xz