From 0fbc82d30d8abe6b23207357a5b56e22fba1bd2b27737f28abec180d18647864 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 18 Mar 2021 07:54:52 +0000 Subject: [PATCH] Accepting request 879718 from home:tomdevries:branches:devel:tools:compiler-dwz-release-0.14 - 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 - 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 OBS-URL: https://build.opensuse.org/request/show/879718 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=36 --- dwz-0.14.tar.xz | 3 + dwz-0.14~rc1.tar.xz | 3 - ...ng-that-cu-is-not-referenced-from-pu.patch | 28 --- dwz-call-reorder_dups-asap.patch | 64 ------- dwz-document-experimental-status-of-odr.patch | 32 ---- dwz-enable-odr-by-default.patch | 12 +- ...ther-reference-from-pu-to-cu-for-odr.patch | 82 +++++++++ dwz-fix-reference-of-pu-to-cu-for-odr.patch | 69 -------- ...red-dup-chains-in-create-import-tree.patch | 107 ++++++++++++ dwz-precompute-partitions.patch | 165 ------------------ dwz-testsuite-fix-pr25109.sh-on-riscv64.patch | 57 ------ dwz-testsuite-fix-pr27463.sh-on-riscv64.patch | 39 +++++ dwz-update-suse-copyright-years.patch | 35 ---- dwz-update-version.patch | 13 -- dwz.changes | 25 +++ dwz.spec | 20 +-- 16 files changed, 267 insertions(+), 487 deletions(-) create mode 100644 dwz-0.14.tar.xz delete mode 100644 dwz-0.14~rc1.tar.xz delete mode 100644 dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch delete mode 100644 dwz-call-reorder_dups-asap.patch delete mode 100644 dwz-document-experimental-status-of-odr.patch create mode 100644 dwz-fix-another-reference-from-pu-to-cu-for-odr.patch delete mode 100644 dwz-fix-reference-of-pu-to-cu-for-odr.patch create mode 100644 dwz-handle-reordered-dup-chains-in-create-import-tree.patch delete mode 100644 dwz-precompute-partitions.patch delete mode 100644 dwz-testsuite-fix-pr25109.sh-on-riscv64.patch create mode 100644 dwz-testsuite-fix-pr27463.sh-on-riscv64.patch delete mode 100644 dwz-update-suse-copyright-years.patch delete mode 100644 dwz-update-version.patch diff --git a/dwz-0.14.tar.xz b/dwz-0.14.tar.xz new file mode 100644 index 0000000..83a6532 --- /dev/null +++ b/dwz-0.14.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87ea6f138bdb85b8ef37883e97b04e329fae56302a49cfd41c267d1f53fe6e0f +size 147428 diff --git a/dwz-0.14~rc1.tar.xz b/dwz-0.14~rc1.tar.xz deleted file mode 100644 index 7aabe98..0000000 --- a/dwz-0.14~rc1.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:370e7c0c09fc68e12fcff237a76b9eb3553833cbeeec6ae12e6c12f41eb9e289 -size 146372 diff --git a/dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch b/dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch deleted file mode 100644 index 1727435..0000000 --- a/dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch +++ /dev/null @@ -1,28 +0,0 @@ -Add assert checking that CU is not referenced from PU - -One of the invariants of dwz is that references from a newly created PU can -only reference other PUs. - -Add an assert that checks this. - -2021-02-25 Tom de Vries - - * dwz.c (write_die): Add assert. - ---- - dwz.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/dwz.c b/dwz.c -index 89cf8d1..887bf24 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -12572,6 +12572,8 @@ write_die (unsigned char *ptr, dw_cu_ref cu, dw_die_ref die, - { - dw_cu_ref refdcu = die_cu (refd); - value = refd->u.p2.die_new_offset; -+ assert (IMPLIES (cu->cu_kind == CU_PU, -+ die_cu (refd)->cu_kind == CU_PU)); - assert (value && refdcu->cu_kind != CU_ALT); - if (t->attr[j].form == DW_FORM_ref_addr) - { diff --git a/dwz-call-reorder_dups-asap.patch b/dwz-call-reorder_dups-asap.patch deleted file mode 100644 index 0c3e91c..0000000 --- a/dwz-call-reorder_dups-asap.patch +++ /dev/null @@ -1,64 +0,0 @@ -Call reorder_dups ASAP - -Currently, we call reorder_dups just before partial unit creation, and only for -DIEs that will be copied. - -This approach causes a problem with reachable DIE propagation (which is done -in partition_dups after phase 1): when a dup-chain that needs to be reordered -(starts with ODR_DECL but also contains ODR_DEF) is marked as reachable during -this propagation, propagation will stop at the ODR_DECL, while it should -continue at the first ODR_DEF instead. - -Fix this by calling reorder_dups ASAP, just after computing the partitions. - -The problem can be detected using this assert: -... -@@ -12563,6 +12563,8 @@ write_die - { - dw_cu_ref refdcu = die_cu (refd); - value = refd->u.p2.die_new_offset; -+ assert (IMPLIES (cu->cu_kind == CU_PU, -+ die_cu (refd)->cu_kind == CU_PU)); - assert (value && refdcu->cu_kind != CU_ALT); - if (t->attr[j].form == DW_FORM_ref_addr) - { -... - -2020-01-25 Tom de Vries - - PR dwz/25424 - * dwz.c (partition_dups_1): Move calling of reorder_dups ... - (partition_dups): ... here. - ---- - dwz.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/dwz.c b/dwz.c -index f435428..9172011 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -8134,13 +8134,6 @@ partition_dups_1 (dw_die_ref *arr, size_t nr_partitions, size_t *partitions, - && (ignore_size || orig_size > new_size)); - if (force) - { -- if (odr_active_p && odr_mode != ODR_BASIC) -- for (k = i; k < j; k++) -- { -- if (second_phase && !arr[k]->die_ref_seen) -- continue; -- arr[k] = reorder_dups (arr[k]); -- } - dw_die_ref die, *diep; - dw_cu_ref refcu = die_cu (arr[i]); - dw_cu_ref partial_cu = pool_alloc (dw_cu, sizeof (struct dw_cu)); -@@ -8474,6 +8467,9 @@ partition_dups (void) - if (stats_p) - stats->part_cnt += nr_partitions; - -+ if (odr_active_p && odr_mode != ODR_BASIC) -+ for (i = 0; i < vec_size; ++i) -+ arr[i] = reorder_dups (arr[i]); - if (partition_dups_1 (arr, nr_partitions, partitions, &first_partial_cu, - &last_partial_cu, false)) - { diff --git a/dwz-document-experimental-status-of-odr.patch b/dwz-document-experimental-status-of-odr.patch deleted file mode 100644 index b5e88c3..0000000 --- a/dwz-document-experimental-status-of-odr.patch +++ /dev/null @@ -1,32 +0,0 @@ -Document experimental status of odr - -Add documentation of the experimental status of the odr optimization in dwz.1. - -2021-02-25 Tom de Vries - - PR dwz/27401 - * dwz.1: Document experimental status of odr. - ---- - dwz.1 | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/dwz.1 b/dwz.1 -index 32df953..63c50d5 100644 ---- a/dwz.1 -+++ b/dwz.1 -@@ -112,11 +112,13 @@ corresponding forms, instead of the GNU extension \fI.gnu_debugaltlink\fR - and corresponding forms. - .TP - .B \-\-odr / \-\-no-odr -+.B Experimental. - Enable/disable One-Definition-Rule optimization for C++ compilation units. - This optimization causes struct/union/class DIEs with the same name to be - 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. -+and may be deduplicated. The status of this optimization is experimental. -+It's disabled in low-mem mode. - Enabled by default. - .TP - .B \-\-odr-mode= diff --git a/dwz-enable-odr-by-default.patch b/dwz-enable-odr-by-default.patch index 7dcb14a..ef72be9 100644 --- a/dwz-enable-odr-by-default.patch +++ b/dwz-enable-odr-by-default.patch @@ -8,20 +8,20 @@ This reverts commit d49096d "[odr] Disable --odr by default". 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dwz.1 b/dwz.1 -index e9117b2..32df953 100644 +index 19dc814..63c50d5 100644 --- a/dwz.1 +++ b/dwz.1 -@@ -117,7 +117,7 @@ This optimization causes struct/union/class DIEs with the same name to be - considered equal. This has the effect that DIEs referring to distinct DIEs +@@ -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. + 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.c b/dwz.c -index 887bf24..3342aba 100644 +index 5effbc1..a02b8fd 100644 --- a/dwz.c +++ b/dwz.c @@ -230,7 +230,7 @@ enum die_count_methods @@ -33,7 +33,7 @@ index 887bf24..3342aba 100644 enum odr_mode { ODR_BASIC, ODR_LINK }; enum odr_mode odr_mode = ODR_LINK; int odr_mode_parsed = 0; -@@ -16283,7 +16283,7 @@ static struct option_help dwz_common_options_help[] = +@@ -16343,7 +16343,7 @@ static struct option_help dwz_common_options_help[] = "Don't optimize files larger than this limit." }, { NULL, "odr", NULL, NULL, NULL }, diff --git a/dwz-fix-another-reference-from-pu-to-cu-for-odr.patch b/dwz-fix-another-reference-from-pu-to-cu-for-odr.patch new file mode 100644 index 0000000..2cd2035 --- /dev/null +++ b/dwz-fix-another-reference-from-pu-to-cu-for-odr.patch @@ -0,0 +1,82 @@ +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 + + 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; diff --git a/dwz-fix-reference-of-pu-to-cu-for-odr.patch b/dwz-fix-reference-of-pu-to-cu-for-odr.patch deleted file mode 100644 index d3248fe..0000000 --- a/dwz-fix-reference-of-pu-to-cu-for-odr.patch +++ /dev/null @@ -1,69 +0,0 @@ -Fix reference of PU to CU for odr - -When compiling dwz with the assert listed in the commit message for -"Call reorder_dups ASAP", and using test-case cc1.dwz-processed like so, we -run into: -... -$ dwz cc1.dwz-processed -o 1 -lnone --odr -dwz: dwz.c:12567: write_die: Assertion \ - `IMPLIES (cu->cu_kind == CU_PU, die_cu (refd)->cu_kind == CU_PU)' failed. -Aborted (core dumped) -... - -The assert is related to this duplicate chain: -... - 28dd83f O b500801d 621b6872 pointer_type \ - (type: 28dd72f die_struct structure_type) - 2903769 O b500801d 621b6872 pointer_type \ - (type: 28dd72f die_struct structure_type) -... -which contains two DIEs that are both in the same CU: -... - <0><28d281f>: Abbrev Number: 200 (DW_TAG_compile_unit) - ... - <1><28dd72f>: Abbrev Number: 35 (DW_TAG_structure_type) - <28dd730> DW_AT_name : (indirect string, offset: 0x1b2ca6): die_struct - <28dd734> DW_AT_byte_size : 80 - <28dd735> DW_AT_decl_file : 87 - <28dd736> DW_AT_decl_line : 3069 - <28dd738> DW_AT_decl_column : 63 - <28dd739> DW_AT_sibling : <0x28dd83b> - <1><28dd83f>: Abbrev Number: 9 (DW_TAG_pointer_type) - <28dd840> DW_AT_byte_size : 8 - <28dd841> DW_AT_type : <0x28dd72f> - ... - <1><2903769>: Abbrev Number: 9 (DW_TAG_pointer_type) - <290376a> DW_AT_byte_size : 8 - <290376b> DW_AT_type : <0x28dd72f> - ... - <0><2911617>: Abbrev Number: 177 (DW_TAG_compile_unit) -... - -The dup chain is forced to a partial unit, but the die_struct DIE is not, -because it's not part of a duplicate chain, and it's not marked as a -singleton. Fix this by marking the die_struct DIE as singleton. - -2021-02-25 Tom de Vries - - PR dwz/27464 - * dwz.c (partition_dups): Call mark_singletons if - cnt_ref_cus (die) == 1. - ---- - dwz.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/dwz.c b/dwz.c -index 9172011..89cf8d1 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -8417,6 +8417,9 @@ partition_dups (void) - if (s) - mark_singletons (die_cu (s), s, s, &ob2); - } -+ else if (cnt_ref_cus (die) == 1) -+ mark_singletons (die_cu (die), die, die, &ob2); -+ - arr = (dw_die_ref *) obstack_base (&ob2); - } - diff --git a/dwz-handle-reordered-dup-chains-in-create-import-tree.patch b/dwz-handle-reordered-dup-chains-in-create-import-tree.patch new file mode 100644 index 0000000..4954d44 --- /dev/null +++ b/dwz-handle-reordered-dup-chains-in-create-import-tree.patch @@ -0,0 +1,107 @@ +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 + + 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) diff --git a/dwz-precompute-partitions.patch b/dwz-precompute-partitions.patch deleted file mode 100644 index 70d77f2..0000000 --- a/dwz-precompute-partitions.patch +++ /dev/null @@ -1,165 +0,0 @@ -Precompute partitions - -Currently, we calculate the duplicate chain partitions in partition_dups_1. -This is done twice, once for phase 1 and once for phase 2. - -Instead, calculate the partitions once in partition_dups, and use those for -both calls to partition_dups_1. - -Performance tested on cc1. This causes a small performance regresssion: -... -user: -series: 5140 5100 5120 5130 5150 5160 5160 5180 5170 5130 \ - 5180 5160 5090 5230 5140 5140 5210 5100 5170 5130 -mean: 5149.50 (100%) -stddev: 35.46 -series: 5120 5190 5230 5190 5200 5160 5170 5210 5270 5180 \ - 5270 5240 5200 5200 5200 5170 5150 5220 5180 5140 -mean: 5194.50 (100.87%) -stddev: 39.13 -... - -There's no significant increase of memory usage: -... -mem: -series: 1260512 1260456 1260492 1260368 1260608 1260268 1260656 1260488 \ - 1260420 1260332 1260464 1260488 1260536 1260340 1260352 1260492 \ - 1260268 1260276 1260316 1260316 -mean: 1260422.40 (100%) -stddev: 113.73 -series: 1260456 1260296 1260244 1260360 1260584 1260344 1260548 1260388 \ - 1260424 1260304 1260252 1260560 1260664 1260476 1260480 1260416 \ - 1260580 1260504 1260604 1260324 -mean: 1260440.40 (100.00%) -... - -We accept the small performance penalty because this patch is a prerequisite -for the PR25424 bug fix. - -2021-02-25 Tom de Vries - - * dwz.c (calculate_partitions): New function, factored out of ... - (partition_dups_1): ... here. Drop vec_size parameter. Add - nr_partitions and partitions parameter. Iterate over partitions array. - (partition_dups): Call calculate_partitions. Update calls to - partition_dups_1. - ---- - dwz.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 53 insertions(+), 22 deletions(-) - -diff --git a/dwz.c b/dwz.c -index e71b3fa..f435428 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -7989,34 +7989,26 @@ cnt_ref_cus (dw_die_ref ref) - multiple CUs might be worthwhile to be moved into partial units, - construct those partial units. */ - static bool --partition_dups_1 (dw_die_ref *arr, size_t vec_size, -+partition_dups_1 (dw_die_ref *arr, size_t nr_partitions, size_t *partitions, - dw_cu_ref *first_partial_cu, - dw_cu_ref *last_partial_cu, - bool second_phase) - { -- size_t i, j; -+ size_t i, j, cnt; - bool ret = false; -- for (i = 0; i < vec_size; i = j) -+ size_t idx = 0; -+ for (idx = 0; idx < nr_partitions * 2; idx += 2) - { -+ i = partitions[idx]; -+ cnt = partitions[idx + 1]; -+ j = partitions[idx + 2]; -+ -+ if (arr[i]->die_dup != NULL) -+ continue; -+ - dw_die_ref ref; -- size_t cnt = 0, size = 0, k, orig_size, new_size, namespaces = 0; -+ size_t size = 0, k, orig_size, new_size, namespaces = 0; - unsigned int force = 0; -- if (arr[i]->die_dup != NULL) -- { -- j = i + 1; -- continue; -- } -- for (j = i + 1; j < vec_size; j++) -- { -- size_t this_cnt; -- if (!same_ref_cus_p (arr[i], arr[j], &this_cnt)) -- break; -- cnt = this_cnt; -- } -- if (stats_p && !second_phase) -- stats->part_cnt++; -- if (cnt == 0) -- cnt = cnt_ref_cus (arr[i]); - enum dwarf_source_language part_lang - = gen_cu_p ? partition_lang (arr[i]) : 0; - for (k = i; k < j; k++) -@@ -8289,6 +8281,36 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size, - return ret; - } - -+/* Partition the duplicate chains in array ARR with size VEC_SIZE, and store -+ the partitions on obstack ob2, with for each partition two entries: -+ the start and the number of unique reffer CUs. */ -+static void -+calculate_partitions (dw_die_ref *arr, size_t vec_size) -+{ -+ size_t i, j; -+ for (i = 0; i < vec_size; i = j) -+ { -+ size_t cnt = 0; -+ for (j = i + 1; j < vec_size; j++) -+ { -+ size_t this_cnt; -+ if (!same_ref_cus_p (arr[i], arr[j], &this_cnt)) -+ break; -+ cnt = this_cnt; -+ } -+ if (cnt == 0) -+ cnt = cnt_ref_cus (arr[i]); -+ obstack_grow (&ob2, &i, sizeof (size_t)); -+ obstack_grow (&ob2, &cnt, sizeof (size_t)); -+ } -+ -+ /* Add element to mark end of partition list. This allows us to do -+ 'j = partitions[idx + 2]' for all partitions. */ -+ obstack_grow (&ob2, &j, sizeof (size_t)); -+ size_t zero = 0; -+ obstack_grow (&ob2, &zero, sizeof (size_t)); -+} -+ - static inline void FORCE_INLINE - reset_die_ref_seen (void) - { -@@ -8443,7 +8465,16 @@ partition_dups (void) - report_progress (); - fprintf (stderr, "partition_dups after qsort\n"); - } -- if (partition_dups_1 (arr, vec_size, &first_partial_cu, -+ -+ size_t *partitions = (size_t *) obstack_base (&ob2); -+ calculate_partitions (arr, vec_size); -+ size_t nr_partitions -+ = (obstack_object_size (&ob2) / sizeof (size_t)) / 2 - 1; -+ partitions = (size_t *) obstack_finish (&ob2); -+ if (stats_p) -+ stats->part_cnt += nr_partitions; -+ -+ if (partition_dups_1 (arr, nr_partitions, partitions, &first_partial_cu, - &last_partial_cu, false)) - { - for (i = 0; i < vec_size; i++) -@@ -8452,7 +8483,7 @@ partition_dups (void) - if (arr[i]->die_dup != NULL) - mark_refs (die_cu (arr[i]), arr[i], arr[i], - MARK_REFS_FOLLOW_DUPS); -- partition_dups_1 (arr, vec_size, &first_partial_cu, -+ partition_dups_1 (arr, nr_partitions, partitions, &first_partial_cu, - &last_partial_cu, true); - for (i = 0; i < vec_size; i++) - arr[i]->die_ref_seen = 0; diff --git a/dwz-testsuite-fix-pr25109.sh-on-riscv64.patch b/dwz-testsuite-fix-pr25109.sh-on-riscv64.patch deleted file mode 100644 index fd4c6e7..0000000 --- a/dwz-testsuite-fix-pr25109.sh-on-riscv64.patch +++ /dev/null @@ -1,57 +0,0 @@ -[testsuite] Fix pr25109.sh on riscv64 - -On riscv64, I run into: -... -cc main.c no-multifile-prop-dw.S -o no-multifile-prop -no-multifile-prop-dw.S: Assembler messages: -no-multifile-prop-dw.S:25: Error: non-constant .uleb128 is not supported -make: *** [Makefile:99: no-multifile-prop] Error 1 -... - -Fix this by allowing to fail to build the test-case, and marking it as -unsupported. - -2021-02-26 Tom de Vries - - * Makefile (no-multifile-prop): Add target rule. - * testsuite/dwz.tests/dwz-tests.exp: Require no-multifile-prop for - pr25109.sh. - ---- - Makefile | 6 +++++- - testsuite/dwz.tests/dwz-tests.exp | 3 +++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index d320266..7969490 100644 ---- a/Makefile -+++ b/Makefile -@@ -95,9 +95,13 @@ $(TEMP_ASM_FILES): %-dw.S: $(TEST_SRC)/../lib/%.exp - export DEJAGNU=$(DEJAGNU); \ - runtest --tool=dwz -srcdir $(srcdir)/testsuite/ lib/$*.exp - --$(TEST_EXECS_DWARF_ASM): %: %-dw.S -+$(filter-out no-multifile-prop, $(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 -+ $(CC) $(TEST_SRC)/main.c $< -o $@ || true -+ - odr-struct: - $(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \ - -DKIND=struct -diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp -index 48c0015..0ad77ea 100644 ---- a/testsuite/dwz.tests/dwz-tests.exp -+++ b/testsuite/dwz.tests/dwz-tests.exp -@@ -86,6 +86,9 @@ foreach test $tests { - continue - } - } -+ if { $basename == "pr25109.sh" } { -+ lappend required_execs no-multifile-prop -+ } - - set unsupported 0 - foreach required_exec $required_execs { diff --git a/dwz-testsuite-fix-pr27463.sh-on-riscv64.patch b/dwz-testsuite-fix-pr27463.sh-on-riscv64.patch new file mode 100644 index 0000000..61e5b83 --- /dev/null +++ b/dwz-testsuite-fix-pr27463.sh-on-riscv64.patch @@ -0,0 +1,39 @@ +[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 + + * 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: diff --git a/dwz-update-suse-copyright-years.patch b/dwz-update-suse-copyright-years.patch deleted file mode 100644 index 9db1283..0000000 --- a/dwz-update-suse-copyright-years.patch +++ /dev/null @@ -1,35 +0,0 @@ -Update SUSE Copyright years - -Update the SUSE copyright range for changes made in 2020 and 2021. - -2021-02-26 Tom de Vries - - * dwz.c: Extend SUSE Copyright range to 2021. - * COPYRIGHT_YEARS: Regenerate. - ---- - COPYRIGHT_YEARS | 2 +- - dwz.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/COPYRIGHT_YEARS b/COPYRIGHT_YEARS -index fdd9942..e4b1511 100644 ---- a/COPYRIGHT_YEARS -+++ b/COPYRIGHT_YEARS -@@ -1,3 +1,3 @@ - -DFSF_YEARS='"1992-2021"' - -DRH_YEARS='"2001-2021"' ---DSUSE_YEARS='"2019"' -+-DSUSE_YEARS='"2019-2021"' -diff --git a/dwz.c b/dwz.c -index 3342aba..bc37f32 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -1,6 +1,6 @@ - /* Copyright (C) 2001-2021 Red Hat, Inc. - Copyright (C) 2003 Free Software Foundation, Inc. -- Copyright (C) 2019 SUSE LLC. -+ Copyright (C) 2019-2021 SUSE LLC. - Written by Jakub Jelinek , 2012. - - This program is free software; you can redistribute it and/or modify diff --git a/dwz-update-version.patch b/dwz-update-version.patch deleted file mode 100644 index fc94a34..0000000 --- a/dwz-update-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -Update VERSION - ---- - VERSION | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/VERSION b/VERSION -index f304084..18657cd 100644 ---- a/VERSION -+++ b/VERSION -@@ -1 +1 @@ --0.13 -+0.14-rc1 diff --git a/dwz.changes b/dwz.changes index 720d13c..8396f9b 100644 --- a/dwz.changes +++ b/dwz.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +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 diff --git a/dwz.spec b/dwz.spec index 37e4707..ef6476e 100644 --- a/dwz.spec +++ b/dwz.spec @@ -42,7 +42,7 @@ ExclusiveArch: do_not_build %endif Name: dwz%{name_suffix} -Version: 0.14~rc1 +Version: 0.14 Release: 0 %if %{build_main} Summary: DWARF optimization and duplicate removal tool @@ -80,15 +80,10 @@ NoSource: 0 Source1: dwz-rpmlintrc -Patch1: dwz-precompute-partitions.patch -Patch2: dwz-call-reorder_dups-asap.patch -Patch3: dwz-fix-reference-of-pu-to-cu-for-odr.patch -Patch4: dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch -Patch5: dwz-enable-odr-by-default.patch -Patch6: dwz-document-experimental-status-of-odr.patch -Patch7: dwz-update-suse-copyright-years.patch -Patch8: dwz-update-version.patch -Patch9: dwz-testsuite-fix-pr25109.sh-on-riscv64.patch +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 %if %{build_main} %description @@ -121,11 +116,6 @@ This package contains the testsuite results from DWZ. %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}"