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-10 08:47:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dwz (Old) and /work/SRC/openSUSE:Factory/.dwz.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dwz" Wed Mar 10 08:47:41 2021 rev:15 rq:875421 version:0.14~rc1 Changes: -------- --- /work/SRC/openSUSE:Factory/dwz/dwz.changes 2021-01-19 15:58:21.923032711 +0100 +++ /work/SRC/openSUSE:Factory/.dwz.new.2378/dwz.changes 2021-03-10 08:48:01.622317463 +0100 @@ -1,0 +2,41 @@ +Fri Feb 26 12:07:30 UTC 2021 - Tom de Vries <[email protected]> + +- 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 <[email protected]> + +- 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 <[email protected]> + +- Update reported dwz version + * dwz-update-version.patch + +------------------------------------------------------------------- +Fri Feb 26 07:52:22 UTC 2021 - Tom de Vries <[email protected]> + +- 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++ +------------------------------------------------------------------- Old: ---- dwz-0.13.tar.xz 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 New: ---- 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-enable-odr-by-default.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 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dwz.spec ++++++ --- /var/tmp/diff_new_pack.GCySBI/_old 2021-03-10 08:48:02.318318182 +0100 +++ /var/tmp/diff_new_pack.GCySBI/_new 2021-03-10 08:48:02.318318182 +0100 @@ -1,5 +1,5 @@ # -# spec file for package dwz +# spec file for package dwz%{name_suffix} # # Copyright (c) 2021 SUSE LLC # @@ -42,7 +42,7 @@ %endif Name: dwz%{name_suffix} -Version: 0.13 +Version: 0.14~rc1 Release: 0 %if %{build_main} Summary: DWARF optimization and duplicate removal tool @@ -63,6 +63,7 @@ %if %{build_testsuite} BuildRequires: dejagnu BuildRequires: elfutils +BuildRequires: gcc-c++ BuildRequires: gdb %ifnarch riscv64 BuildRequires: binutils-gold @@ -79,15 +80,15 @@ Source1: dwz-rpmlintrc -Patch1: dwz-update-version-copyright-message.patch -Patch2: dwz-fix-die-no-multifile-propagation.patch -Patch3: dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch -Patch4: dwz-fix-refd-NULL-assertion-in-write_die.patch -Patch5: dwz-fix-reference-from-pu-to-cu.patch -Patch6: dwz-fix-segfault-in-die_cu.patch -Patch7: dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch -Patch8: dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch -Patch9: dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch +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 %if %{build_main} %description ++++++ dwz-add-assert-checking-that-cu-is-not-referenced-from-pu.patch ++++++ 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 <[email protected]> * 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) { ++++++ dwz-call-reorder_dups-asap.patch ++++++ 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 <[email protected]> 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)) { ++++++ dwz-document-experimental-status-of-odr.patch ++++++ Document experimental status of odr Add documentation of the experimental status of the odr optimization in dwz.1. 2021-02-25 Tom de Vries <[email protected]> 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=<basic|link> ++++++ dwz-enable-odr-by-default.patch ++++++ 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 e9117b2..32df953 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 representing the same type (like f.i. pointer type DIEs) are considered equal, and may be deduplicated. -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 --- a/dwz.c +++ b/dwz.c @@ -230,7 +230,7 @@ enum die_count_methods }; static 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; @@ -16283,7 +16283,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", "<basic|link>", "link", "Set aggressiveness level of one definition rule optimization." }, ++++++ dwz-fix-reference-of-pu-to-cu-for-odr.patch ++++++ 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 <[email protected]> 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); } ++++++ dwz-precompute-partitions.patch ++++++ 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 <[email protected]> * 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; ++++++ dwz-testsuite-fix-pr25109.sh-on-riscv64.patch ++++++ [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 <[email protected]> * 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 { ++++++ dwz-update-suse-copyright-years.patch ++++++ Update SUSE Copyright years Update the SUSE copyright range for changes made in 2020 and 2021. 2021-02-26 Tom de Vries <[email protected]> * 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 <[email protected]>, 2012. This program is free software; you can redistribute it and/or modify ++++++ dwz-update-version-copyright-message.patch -> dwz-update-version.patch ++++++ --- /work/SRC/openSUSE:Factory/dwz/dwz-update-version-copyright-message.patch 2019-08-27 12:00:15.971660298 +0200 +++ /work/SRC/openSUSE:Factory/.dwz.new.2378/dwz-update-version.patch 2021-03-10 08:48:01.546317385 +0100 @@ -1,294 +1,13 @@ -Update --version copyright message - -[ This is a backport of master commit dda7184. Output of -contrib/gen-copyright-years.sh and dwz --version in this log message have been -updated accordingly. ] - -In commit 9a663b4 "Update copyright" we've updated copyright in the sources, -but not in the --version copyright message. - -Update the --version copyright message, using new script -contrib/gen-copyright-years.sh that extracts the copyright years from the -source files, and generates a file COPYRIGHT_YEARS containing define flags: -... --DFSF_YEARS='"1992-2017"' --DRH_YEARS='"2001-2018"' --DSUSE_YEARS='"2019"' -... -resulting in: -... -$ dwz --version -dwz version 0.13 -Copyright (C) 2001-2018 Red Hat, Inc. -Copyright (C) 1992-2017 Free Software Foundation, Inc. -Copyright (C) 2019 SUSE LLC. -... - -2019-08-15 Tom de Vries <[email protected]> - - * contrib/copyright-lines.awk: New file. - * contrib/gen-copyright-years.sh: New file. - * COPYRIGHT_YEARS: Generate. - * Makefile (override CFLAGS +=, dwz-for-test): Add COPYRIGHT_YEARS - defines. - * dwz.c (version): Update copyright message using COPYRIGHT_YEARS - defines. +Update VERSION --- - COPYRIGHT_YEARS | 3 + - Makefile | 6 +- - contrib/copyright-lines.awk | 27 +++++++ - contrib/gen-copyright-years.sh | 162 +++++++++++++++++++++++++++++++++++++++++ - dwz.c | 5 +- - 5 files changed, 199 insertions(+), 4 deletions(-) + VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/COPYRIGHT_YEARS b/COPYRIGHT_YEARS -new file mode 100644 -index 0000000..1dc95a5 ---- /dev/null -+++ b/COPYRIGHT_YEARS -@@ -0,0 +1,3 @@ -+-DFSF_YEARS='"1992-2017"' -+-DRH_YEARS='"2001-2018"' -+-DSUSE_YEARS='"2019"' -diff --git a/Makefile b/Makefile -index 7e281e5..c945c9d 100644 ---- a/Makefile -+++ b/Makefile -@@ -5,7 +5,8 @@ srcdir=$(shell pwd) - endif - CFLAGS = -O2 -g - DWZ_VERSION := $(shell cat $(srcdir)/VERSION) --override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"$(DWZ_VERSION)"' -+override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 \ -+ -DDWZ_VERSION='"$(DWZ_VERSION)"' $(shell cat $(srcdir)/COPYRIGHT_YEARS) - prefix = /usr - exec_prefix = $(prefix) - bindir = $(exec_prefix)/bin -@@ -52,7 +53,8 @@ DWZ_TEST_SOURCES := $(patsubst %.o,%-for-test.c,$(OBJECTS)) - - dwz-for-test: $(DWZ_TEST_SOURCES) - $(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W -DDEVEL \ -- -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir) -+ -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir) \ -+ $(shell cat $(srcdir)/COPYRIGHT_YEARS) - - min: - $(CC) $(TEST_SRC)/min.c $(TEST_SRC)/min-2.c -o $@ -g -diff --git a/contrib/copyright-lines.awk b/contrib/copyright-lines.awk -new file mode 100644 -index 0000000..b031c50 ---- /dev/null -+++ b/contrib/copyright-lines.awk -@@ -0,0 +1,27 @@ -+BEGIN { -+ start=0 -+} -+ -+/Copyright \(C\).*[.]/ { -+ print -+ next -+} -+ -+/Copyright \(C\)/ { -+ start=1 -+ printf $0 -+ next -+} -+ -+/[.]/ { -+ if (start == 0) -+ next -+ print -+ start=0 -+} -+ -+// { -+ if (start == 0) -+ next -+ printf $0 -+} -diff --git a/contrib/gen-copyright-years.sh b/contrib/gen-copyright-years.sh -new file mode 100755 -index 0000000..1ef6f3f ---- /dev/null -+++ b/contrib/gen-copyright-years.sh -@@ -0,0 +1,162 @@ -+#!/bin/bash -+ -+this=$(basename $0) -+ -+max () -+{ -+ local a -+ a=$1 -+ local b -+ b=$2 -+ -+ if [ "$a" = "" ]; then -+ echo "$b" -+ return -+ elif [ "$b" = "" ]; then -+ echo "$a" -+ return -+ fi -+ -+ if [ $a -gt $b ]; then -+ echo "$a" -+ else -+ echo "$b" -+ fi -+} -+ -+min () -+{ -+ local a -+ a="$1" -+ local b -+ b="$2" -+ -+ if [ "$a" = "" ]; then -+ echo "$b" -+ return -+ elif [ "$b" = "" ]; then -+ echo "$a" -+ return -+ fi -+ -+ if [ $a -lt $b ]; then -+ echo "$a" -+ else -+ echo "$b" -+ fi -+} -+ -+print_range () { -+ local a -+ a="$1" -+ local b -+ b="$2" -+ -+ if [ "$a" = "$b" ]; then -+ echo "$a" -+ return -+ fi -+ echo "$a-$b" -+} -+ -+process_line () -+{ -+ local line -+ line="$1" -+ -+ fsf=false -+ rh=false -+ suse=false; -+ -+ if echo "$line" \ -+ | grep -q "Free Software Foundation, Inc\."; then -+ fsf=true -+ who=fsf -+ line=$(echo "$line" \ -+ | sed 's/Free Software Foundation, Inc\.//') -+ elif echo "$line" \ -+ | grep -q "Red Hat, Inc\."; then -+ rh=true -+ who=rh -+ line=$(echo "$line" \ -+ | sed 's/Red Hat, Inc\.//') -+ elif echo "$line" \ -+ | grep -q "SUSE LLC\."; then -+ suse=true -+ who=suse -+ line=$(echo "$line" \ -+ | sed 's/SUSE LLC\.//') -+ else -+ echo "error: unknown copyright: $line" -+ exit 1 -+ fi -+ -+ line=$(echo "$line" \ -+ | sed 's/[,-]/ /g') -+ max_year=$(echo "$line" \ -+ | sed 's/ /\n/g' \ -+ | grep -v '^$' \ -+ | sort -n -r \ -+ | head -n 1) -+ min_year=$(echo "$line" \ -+ | sed 's/ /\n/g' \ -+ | grep -v '^$' \ -+ | sort -n \ -+ | head -n 1) -+ -+ if $fsf; then -+ fsf_max=$(max "$fsf_max" "$max_year") -+ fsf_min=$(min "$fsf_min" "$min_year") -+ elif $rh; then -+ rh_max=$(max "$rh_max" "$max_year") -+ rh_min=$(min "$rh_min" "$min_year") -+ elif $suse; then -+ suse_max=$(max "$suse_max" "$max_year") -+ suse_min=$(min "$suse_min" "$min_year") -+ fi -+} -+ -+main () -+{ -+ if ! git status --ignored 2>&1 \ -+ | grep -q "nothing to commit, working tree clean"; then -+ echo "Git tree not clean" -+ exit 1 -+ fi -+ -+ local tmp -+ tmp=$(mktemp) -+ -+ for f in *.c *.h *.def; do -+ if ! grep -q "Copyright (C)" $f; then -+ echo "error: found file without copyright marker: $f" -+ exit 1 -+ fi -+ -+ echo processing file: $f -+ -+ grep -v '"' $f \ -+ | awk -f contrib/copyright-lines.awk \ -+ > $tmp -+ -+ while read line; do -+ line=$(echo "$line" \ -+ | sed 's/ */ /g') -+ line=$(echo "$line" \ -+ | sed 's/.*Copyright (C) *//') -+ echo "Processing line: $line" -+ process_line "$line" -+ done < $tmp -+ done -+ -+ rm -f $tmp -+ -+ echo "-DFSF_YEARS='\"$(print_range $fsf_min $fsf_max)\"'" \ -+ > COPYRIGHT_YEARS -+ echo "-DRH_YEARS='\"$(print_range $rh_min $rh_max)\"'" \ -+ >> COPYRIGHT_YEARS -+ echo "-DSUSE_YEARS='\"$(print_range $suse_min $suse_max)\"'" \ -+ >> COPYRIGHT_YEARS -+} -+ -+main "$@" -diff --git a/dwz.c b/dwz.c -index 266f56d..727314f 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -12395,8 +12395,9 @@ version (void) - { - fprintf (stderr, - "dwz version " DWZ_VERSION "\n" -- "Copyright (C) 2001-2012 Red Hat, Inc.\n" -- "Copyright (C) 2003 Free Software Foundation, Inc.\n" -+ "Copyright (C) " RH_YEARS " Red Hat, Inc.\n" -+ "Copyright (C) " FSF_YEARS " Free Software Foundation, Inc.\n" -+ "Copyright (C) " SUSE_YEARS " SUSE LLC.\n" - "This program is free software; you may redistribute it under the terms of\n" - "the GNU General Public License version 3 or (at your option) any later version.\n" - "This program has absolutely no warranty.\n"); +diff --git a/VERSION b/VERSION +index f304084..18657cd 100644 +--- a/VERSION ++++ b/VERSION +@@ -1 +1 @@ +-0.13 ++0.14-rc1
