Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dwz for openSUSE:Factory checked in at 2021-03-21 23:19:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dwz (Old) and /work/SRC/openSUSE:Factory/.dwz.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dwz" Sun Mar 21 23:19:07 2021 rev:16 rq:879825 version:0.14 Changes: -------- --- /work/SRC/openSUSE:Factory/dwz/dwz.changes 2021-03-10 08:48:01.622317463 +0100 +++ /work/SRC/openSUSE:Factory/.dwz.new.2401/dwz.changes 2021-03-21 23:19:07.580713611 +0100 @@ -1,0 +2,25 @@ +Wed Mar 17 15:54:22 UTC 2021 - Tom de Vries <[email protected]> + +- 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 <[email protected]> + +- 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 + +------------------------------------------------------------------- Old: ---- dwz-0.14~rc1.tar.xz 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 New: ---- dwz-0.14.tar.xz 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 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dwz.spec ++++++ --- /var/tmp/diff_new_pack.cBk9zq/_old 2021-03-21 23:19:08.200713824 +0100 +++ /var/tmp/diff_new_pack.cBk9zq/_new 2021-03-21 23:19:08.204713825 +0100 @@ -42,7 +42,7 @@ %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 @@ 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 @@ %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}" ++++++ dwz-0.14~rc1.tar.xz -> dwz-0.14.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/COPYRIGHT_YEARS new/dwz/COPYRIGHT_YEARS --- old/dwz/COPYRIGHT_YEARS 2021-02-26 08:43:18.640210682 +0100 +++ new/dwz/COPYRIGHT_YEARS 2021-03-08 08:56:18.976431406 +0100 @@ -1,3 +1,3 @@ -DFSF_YEARS='"1992-2021"' -DRH_YEARS='"2001-2021"' --DSUSE_YEARS='"2019"' +-DSUSE_YEARS='"2019-2021"' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/Makefile new/dwz/Makefile --- old/dwz/Makefile 2021-02-26 08:43:18.640210682 +0100 +++ new/dwz/Makefile 2021-03-08 08:56:18.976431406 +0100 @@ -26,7 +26,8 @@ PWD:=$(shell pwd -P) TEST_SRC = $(srcdir)/testsuite/dwz.tests -TEST_EXECS_DWARF_ASM = no-multifile-prop invalid-dw-at-stmt-list-encoding +TEST_EXECS_DWARF_ASM = no-multifile-prop invalid-dw-at-stmt-list-encoding \ + unavailable-dwarf-piece TEST_EXECS_x86_64 = py-section-script dw2-skip-prologue \ implptr-64bit-d2o4a8r8t0 varval TEST_EXECS = hello dwz-for-test min two-typedef start hello-gold-gdb-index \ @@ -95,9 +96,13 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/VERSION new/dwz/VERSION --- old/dwz/VERSION 2021-02-26 08:43:18.640210682 +0100 +++ new/dwz/VERSION 2021-03-08 08:56:18.976431406 +0100 @@ -1 +1 @@ -0.13 +0.14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/dwz.1 new/dwz/dwz.1 --- old/dwz/dwz.1 2021-02-26 08:43:18.640210682 +0100 +++ new/dwz/dwz.1 2021-03-08 08:56:18.976431406 +0100 @@ -112,11 +112,13 @@ 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. Disabled by default. .TP .B \-\-odr-mode=<basic|link> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/dwz.c new/dwz/dwz.c --- old/dwz/dwz.c 2021-02-26 08:43:18.640210682 +0100 +++ new/dwz/dwz.c 2021-03-08 08:56:18.980431379 +0100 @@ -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 <[email protected]>, 2012. This program is free software; you can redistribute it and/or modify @@ -3462,8 +3462,35 @@ case DW_FORM_data8: value = read_64 (ptr); handled = true; break; case DW_FORM_udata: value = read_uleb128 (ptr); handled = true; break; + case DW_FORM_sdata: + { + int64_t svalue = read_sleb128 (ptr); + if (svalue >= 0) + { + value = svalue; + handled = true; + break; + } + else + { + negative: + error (0, 0, "%s: negative value %" PRId64 " for %s", + dso->filename, svalue, + get_DW_AT_str (t->attr[i].attr)); + return 1; + } + } case DW_FORM_implicit_const: - value = t->values[i]; handled = true; break; + { + if (t->values[i] >= 0) + { + value = t->values[i]; + handled = true; + break; + } + else + goto negative; + } default: error (0, 0, "%s: Unhandled %s for %s", dso->filename, get_DW_FORM_str (form), @@ -3541,8 +3568,27 @@ case DW_FORM_data8: value = read_64 (ptr); handled = true; break; case DW_FORM_udata: value = read_uleb128 (ptr); handled = true; break; + case DW_FORM_sdata: + { + int64_t svalue = read_sleb128 (ptr); + if (svalue >= 0) + { + value = svalue; + handled = true; + break; + } + else + goto negative; + } case DW_FORM_implicit_const: - value = t->values[i]; handled = true; break; + if (t->values[i] >= 0) + { + value = t->values[i]; + handled = true; + break; + } + else + goto negative; default: error (0, 0, "%s: Unhandled %s for %s", dso->filename, get_DW_FORM_str (form), @@ -4775,6 +4821,7 @@ case DW_FORM_data4: value1 = read_32 (ptr1); break; case DW_FORM_data8: value1 = read_64 (ptr1); break; case DW_FORM_udata: value1 = read_uleb128 (ptr1); break; + case DW_FORM_sdata: value1 = read_sleb128 (ptr1); break; case DW_FORM_implicit_const: value1 = t1->values[i]; break; default: abort (); } @@ -4785,6 +4832,7 @@ case DW_FORM_data4: value2 = read_32 (ptr2); break; case DW_FORM_data8: value2 = read_64 (ptr2); break; case DW_FORM_udata: value2 = read_uleb128 (ptr2); break; + case DW_FORM_sdata: value2 = read_sleb128 (ptr2); break; case DW_FORM_implicit_const: value2 = t2->values[j]; break; default: abort (); } @@ -4867,6 +4915,7 @@ case DW_FORM_data4: value1 = read_32 (ptr1); break; case DW_FORM_data8: value1 = read_64 (ptr1); break; case DW_FORM_udata: value1 = read_uleb128 (ptr1); break; + case DW_FORM_sdata: value1 = read_sleb128 (ptr1); break; case DW_FORM_implicit_const: value1 = t1->values[i]; break; default: abort (); } @@ -4877,6 +4926,7 @@ case DW_FORM_data4: value2 = read_32 (ptr2); break; case DW_FORM_data8: value2 = read_64 (ptr2); break; case DW_FORM_udata: value2 = read_uleb128 (ptr2); break; + case DW_FORM_sdata: value2 = read_sleb128 (ptr2); break; case DW_FORM_implicit_const: value2 = t2->values[j]; break; default: abort (); } @@ -7989,34 +8039,26 @@ 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++) @@ -8142,13 +8184,6 @@ && (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)); @@ -8289,6 +8324,36 @@ 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) { @@ -8402,6 +8467,9 @@ 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); } @@ -8443,7 +8511,19 @@ 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 (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)) { for (i = 0; i < vec_size; i++) @@ -8452,7 +8532,7 @@ 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; @@ -10665,6 +10745,7 @@ case DW_FORM_data4: value = read_32 (ptr); break; case DW_FORM_data8: value = read_64 (ptr); break; case DW_FORM_udata: value = read_uleb128 (ptr); break; + case DW_FORM_sdata: value = read_sleb128 (ptr); break; case DW_FORM_implicit_const: value = reft->values[i]; break; @@ -12285,6 +12366,9 @@ case DW_FORM_udata: value = read_uleb128 (inptr); break; + case DW_FORM_sdata: + value = read_sleb128 (inptr); + break; case DW_FORM_implicit_const: /* DW_FORM_implicit_const should have been updated already when computing abbrevs. */ @@ -12300,6 +12384,7 @@ case DW_FORM_data4: write_32 (ptr, value); break; case DW_FORM_data8: write_64 (ptr, value); break; case DW_FORM_udata: write_uleb128 (ptr, value); break; + case DW_FORM_sdata: write_sleb128 (ptr, value); break; default: abort (); } j++; @@ -12542,6 +12627,8 @@ { 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) { @@ -15063,7 +15150,7 @@ debug_sections[DEBUG_MACRO].new_size) != (ssize_t) debug_sections[DEBUG_MACRO].new_size) || (strp_htab != NULL && write_multifile_strp ()) - || (line_htab != NULL && write_multifile_line ())) + || write_multifile_line ()) { error (0, 0, "Error writing multi-file temporary files"); ret = 1; @@ -15168,6 +15255,10 @@ /* Helper structure for hardlink discovery. */ struct file_result { + /* -2: Already processed under different name. + -1: Ignore. + 0: Processed, changed. + 1: Processed, unchanged. */ int res; dev_t dev; ino_t ino; @@ -15228,7 +15319,7 @@ file); close (fd); res->res = -2; - return 1; + return 0; } /* If it changed, try to hardlink it again. */ if (resa[n].res == 0) @@ -15347,8 +15438,8 @@ } else if (write_aranges (dso)) { - cleanup (); failure: + cleanup (); ret = 1; } else @@ -15485,6 +15576,9 @@ if (write_dso (dso, outfile, &st, save_to_temp)) ret = 1; + else + res->res = 0; + if (unlikely (progress_p)) report_progress (); } @@ -15508,8 +15602,6 @@ close (fd); free (dso); - if (ret == 0 && !low_mem) - res->res = 0; if (ret == 3) { ret = (outfile != NULL) ? 1 : 0; @@ -16717,10 +16809,10 @@ thisret = dwz (file, NULL, &resa[i - optind], hardlinks ? resa : NULL, &argv[optind]); } - else if (resa[i - optind].res == 0) - successcount++; else if (thisret == 1) ret = 1; + else if (resa[i - optind].res >= 0) + successcount++; if (hardlink && resa[i - optind].res >= 0 && resa[i - optind].nlink > 1) @@ -16759,8 +16851,7 @@ multifile_mode = MULTIFILE_MODE_FI; /* Don't process again files that couldn't be processed successfully. */ - if (resa[i - optind].res == -1 - || resa[i - optind].res == 1) + if (resa[i - optind].res == -1) continue; for (cu = alt_first_cu; cu; cu = cu->cu_next) alt_clear_dups (cu->cu_die); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/dwz.tests/dwz-tests.exp new/dwz/testsuite/dwz.tests/dwz-tests.exp --- old/dwz/testsuite/dwz.tests/dwz-tests.exp 2021-02-26 08:43:18.644210658 +0100 +++ new/dwz/testsuite/dwz.tests/dwz-tests.exp 2021-03-08 08:56:18.980431379 +0100 @@ -86,6 +86,12 @@ continue } } + if { $basename == "pr25109.sh" } { + lappend required_execs no-multifile-prop + } + if { $basename == "pr27463.sh" } { + lappend required_execs unavailable-dwarf-piece + } set unsupported 0 foreach required_exec $required_execs { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/dwz.tests/main.c new/dwz/testsuite/dwz.tests/main.c --- old/dwz/testsuite/dwz.tests/main.c 2021-02-26 08:43:18.644210658 +0100 +++ new/dwz/testsuite/dwz.tests/main.c 2021-03-08 08:56:18.980431379 +0100 @@ -3,3 +3,23 @@ { return 0; } + +int +foo (int i) +{ + int j; + asm (".global foo_start_lbl\nfoo_start_lbl:"); + j = i *2; + asm (".global foo_end_lbl\nfoo_end_lbl:"); + return j; +} + +int +bar (int i) +{ + int j; + asm (".global bar_start_lbl\nbar_start_lbl:"); + j = i *2; + asm (".global bar_end_lbl\nbar_end_lbl:"); + return j; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/dwz.tests/odr-loc.sh new/dwz/testsuite/dwz.tests/odr-loc.sh --- old/dwz/testsuite/dwz.tests/odr-loc.sh 2021-02-26 08:43:18.644210658 +0100 +++ new/dwz/testsuite/dwz.tests/odr-loc.sh 2021-03-08 08:56:18.980431379 +0100 @@ -9,7 +9,7 @@ [ $cnt -eq 2 ] done -$execs/dwz-for-test --odr 1 +$execs/dwz-for-test --odr 1 --devel-ignore-size verify-dwarf.sh 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/dwz.tests/pr27463.sh new/dwz/testsuite/dwz.tests/pr27463.sh --- old/dwz/testsuite/dwz.tests/pr27463.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/dwz/testsuite/dwz.tests/pr27463.sh 2021-03-08 08:56:18.980431379 +0100 @@ -0,0 +1,6 @@ +cp $execs/unavailable-dwarf-piece 1 +cp 1 2 + +dwz -m 3 1 2 + +rm -f 1 2 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/dwz.tests/twice-hardlink.sh new/dwz/testsuite/dwz.tests/twice-hardlink.sh --- old/dwz/testsuite/dwz.tests/twice-hardlink.sh 2021-02-26 08:43:18.648210633 +0100 +++ new/dwz/testsuite/dwz.tests/twice-hardlink.sh 2021-03-08 08:56:18.980431379 +0100 @@ -29,8 +29,3 @@ cmp 1 1.saved rm -f 1 1.saved 2 2.saved dwz.err - -if [ -f 2.#dwz#.* ]; then - echo "PR24275 workaround used" > dwz.info - rm -f 2.#dwz#.* -fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwz/testsuite/lib/unavailable-dwarf-piece.exp new/dwz/testsuite/lib/unavailable-dwarf-piece.exp --- old/dwz/testsuite/lib/unavailable-dwarf-piece.exp 1970-01-01 01:00:00.000000000 +0100 +++ new/dwz/testsuite/lib/unavailable-dwarf-piece.exp 2021-03-08 08:56:18.984431355 +0100 @@ -0,0 +1,272 @@ +# Copyright (C) 2013-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +load_lib dwarf-lib.exp +load_lib dwarf.exp + +set asm_file unavailable-dwarf-piece-dw.S + +Dwarf::assemble $asm_file { + declare_labels uchar_label struct_s_label foo_label struct_t_label bar_label + + cu {} { + compile_unit {{language @DW_LANG_C}} { + uchar_label: DW_TAG_base_type { + {name "unsigned char"} + {byte_size 1 DW_FORM_sdata} + {encoding @DW_ATE_unsigned_char} + } + + struct_s_label: DW_TAG_structure_type { + {name s} + {byte_size 3 DW_FORM_sdata} + {decl_file 0 DW_FORM_udata} + {decl_line 1 DW_FORM_sdata} + } { + DW_TAG_member { + {name a} + {type :$uchar_label} + {data_member_location { + DW_OP_plus_uconst 0 + } SPECIAL_expr} + } + DW_TAG_member { + {name b} + {type :$uchar_label} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name c} + {type :$uchar_label} + {data_member_location { + DW_OP_plus_uconst 2 + } SPECIAL_expr} + } + } + + struct_t_label: DW_TAG_structure_type { + {name t} + {byte_size 3 DW_FORM_sdata} + {decl_file 0 DW_FORM_udata} + {decl_line 1 DW_FORM_sdata} + } { + DW_TAG_member { + {name a} + {type :$uchar_label} + {data_member_location { + DW_OP_plus_uconst 0 + } SPECIAL_expr} + } + DW_TAG_member { + {name b} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 7 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name c} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 6 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name d} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 5 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name e} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 4 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name f} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 3 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name g} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 2 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name h} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 1 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name i} + {type :$uchar_label} + {byte_size 1 DW_FORM_sdata} + {bit_size 1 DW_FORM_sdata} + {bit_offset 0 DW_FORM_sdata} + {data_member_location { + DW_OP_plus_uconst 1 + } SPECIAL_expr} + } + DW_TAG_member { + {name j} + {type :$uchar_label} + {data_member_location { + DW_OP_plus_uconst 2 + } SPECIAL_expr} + } + } + + DW_TAG_subprogram { + {name foo} + {decl_file 0 udata} + {low_pc foo_start_lbl addr} + {high_pc foo_end_lbl addr} + } { + DW_TAG_formal_parameter { + {type :$struct_s_label} + {name x} + {location { + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 2 + DW_OP_reg0 + DW_OP_piece 1 + } SPECIAL_expr} + } + DW_TAG_formal_parameter { + {type :$struct_s_label} + {name y} + {location { + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + DW_OP_reg0 + DW_OP_piece 1 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + } SPECIAL_expr} + } + DW_TAG_formal_parameter { + {type :$struct_s_label} + {name z} + {location { + DW_OP_reg0 + DW_OP_piece 1 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 2 + } SPECIAL_expr} + } + } + + + DW_TAG_subprogram { + {name bar} + {decl_file 0 udata} + {low_pc bar_start_lbl addr} + {high_pc bar_end_lbl addr} + } { + DW_TAG_formal_parameter { + {type :$struct_t_label} + {name x} + {location { + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + DW_OP_reg0 + DW_OP_bit_piece 1 0 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_bit_piece 7 0 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + } SPECIAL_expr} + } + DW_TAG_formal_parameter { + {type :$struct_t_label} + {name y} + {location { + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_bit_piece 3 0 + DW_OP_reg0 + DW_OP_bit_piece 1 0 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_bit_piece 4 0 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + } SPECIAL_expr} + } + DW_TAG_formal_parameter { + {type :$struct_t_label} + {name z} + {location { + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_bit_piece 7 0 + DW_OP_reg0 + DW_OP_bit_piece 1 0 + DW_OP_lit0 + DW_OP_stack_value + DW_OP_piece 1 + } SPECIAL_expr} + } + } + + } + } +} ++++++ dwz-enable-odr-by-default.patch ++++++ --- /var/tmp/diff_new_pack.cBk9zq/_old 2021-03-21 23:19:08.344713873 +0100 +++ /var/tmp/diff_new_pack.cBk9zq/_new 2021-03-21 23:19:08.344713873 +0100 @@ -8,20 +8,20 @@ 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=<basic|link> 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 @@ 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 }, ++++++ dwz-fix-another-reference-from-pu-to-cu-for-odr.patch ++++++ 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 <[email protected]> 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; ++++++ dwz-handle-reordered-dup-chains-in-create-import-tree.patch ++++++ 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 <[email protected]> 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) ++++++ dwz-testsuite-fix-pr25109.sh-on-riscv64.patch -> dwz-testsuite-fix-pr27463.sh-on-riscv64.patch ++++++ --- /work/SRC/openSUSE:Factory/dwz/dwz-testsuite-fix-pr25109.sh-on-riscv64.patch 2021-03-10 08:48:01.374317208 +0100 +++ /work/SRC/openSUSE:Factory/.dwz.new.2401/dwz-testsuite-fix-pr27463.sh-on-riscv64.patch 2021-03-21 23:19:07.560713604 +0100 @@ -1,57 +1,39 @@ -[testsuite] Fix pr25109.sh on riscv64 +[testsuite] Fix pr27463.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 +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 by allowing to fail to build the test-case, and marking it as -unsupported. +Fix this similar to commit 53c0488 "[testsuite] Fix pr25109.sh on riscv64". -2021-02-26 Tom de Vries <[email protected]> +2021-03-17 Tom de Vries <[email protected]> - * Makefile (no-multifile-prop): Add target rule. - * testsuite/dwz.tests/dwz-tests.exp: Require no-multifile-prop for - pr25109.sh. + * Makefile (no-multifile-prop): Allow target rule to fail. --- - Makefile | 6 +++++- - testsuite/dwz.tests/dwz-tests.exp | 3 +++ - 2 files changed, 8 insertions(+), 1 deletion(-) + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index d320266..7969490 100644 +index 2f7c76a..2990567 100644 --- a/Makefile +++ b/Makefile -@@ -95,9 +95,13 @@ $(TEMP_ASM_FILES): %-dw.S: $(TEST_SRC)/../lib/%.exp +@@ -96,11 +96,11 @@ $(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 +-$(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 -+ $(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 -+ } + # 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 - set unsupported 0 - foreach required_exec $required_execs { + odr-struct:
