From 2110f71c32931f0c773cb24570e8f785d7f265b70c9c4417942e744311f647d3 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Mon, 5 Aug 2019 12:17:32 +0000 Subject: [PATCH 1/3] Accepting request 720579 from home:tomdevries:branches:devel:tools:compiler-2 DWZ 0.13 update OBS-URL: https://build.opensuse.org/request/show/720579 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=15 --- dwz-0.12-DW_OP_GNU_variable_value.patch | 35 ----- dwz-0.12-ignore-nobits.patch | 138 ------------------ dwz-0.12.tar.xz | 3 - dwz-0.13.tar.xz | 3 + ...rameter_ref-handling-in-read_exprloc.patch | 57 -------- dwz.changes | 12 ++ dwz.spec | 16 +- 7 files changed, 24 insertions(+), 240 deletions(-) delete mode 100644 dwz-0.12-DW_OP_GNU_variable_value.patch delete mode 100644 dwz-0.12-ignore-nobits.patch delete mode 100644 dwz-0.12.tar.xz create mode 100644 dwz-0.13.tar.xz delete mode 100644 dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch diff --git a/dwz-0.12-DW_OP_GNU_variable_value.patch b/dwz-0.12-DW_OP_GNU_variable_value.patch deleted file mode 100644 index a89e0bc..0000000 --- a/dwz-0.12-DW_OP_GNU_variable_value.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/dwarf2.def b/dwarf2.def -index e9a8bca..17311fa 100644 ---- a/dwarf2.def -+++ b/dwarf2.def -@@ -588,6 +588,9 @@ DW_OP (DW_OP_GNU_reinterpret, 0xf9) - DW_OP (DW_OP_GNU_parameter_ref, 0xfa) - /* Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. */ - DW_OP (DW_OP_GNU_addr_index, 0xfb) -+/* The GNU variable value extension. -+ See http://dwarfstd.org/ShowIssue.php?issue=161109.2 . */ -+DW_OP (DW_OP_GNU_variable_value, 0xfd) - /* HP extensions. */ - DW_OP_DUP (DW_OP_HP_unknown, 0xe0) /* Ouch, the same as GNU_push_tls_address. */ - DW_OP (DW_OP_HP_is_value, 0xe1) -diff --git a/dwz.c b/dwz.c -index b3b779d..b387ebc 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -1522,6 +1522,7 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, - ptr += 4; - break; - case DW_OP_call_ref: -+ case DW_OP_GNU_variable_value: - case DW_OP_GNU_implicit_pointer: - cu = die_cu (die); - addr = read_size (ptr, cu->cu_version == 2 ? ptr_size : 4); -@@ -8576,6 +8577,7 @@ adjust_exprloc (dw_cu_ref cu, dw_die_ref die, dw_cu_ref refcu, - ptr += 4; - break; - case DW_OP_call_ref: -+ case DW_OP_GNU_variable_value: - case DW_OP_GNU_implicit_pointer: - addr = read_size (ptr, refcu->cu_version == 2 ? ptr_size : 4); - assert (cu->cu_version == refcu->cu_version); - diff --git a/dwz-0.12-ignore-nobits.patch b/dwz-0.12-ignore-nobits.patch deleted file mode 100644 index 4448f4e..0000000 --- a/dwz-0.12-ignore-nobits.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff --git a/dwz.c b/dwz.c -index b3b779d..5ab45a2 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -10016,6 +10016,26 @@ error_out: - return NULL; - } - -+/* Sort shdr indices after sh_offset. */ -+static DSO *shdr_sort_compar_dso; -+static int -+shdr_sort_compar (const void *p1, const void *p2) -+{ -+ const int *idx1 = (const int *)p1; -+ const int *idx2 = (const int *)p2; -+ if (shdr_sort_compar_dso->shdr[*idx1].sh_offset -+ < shdr_sort_compar_dso->shdr[*idx2].sh_offset) -+ return -1; -+ else if (shdr_sort_compar_dso->shdr[*idx1].sh_offset -+ > shdr_sort_compar_dso->shdr[*idx2].sh_offset) -+ return 1; -+ if (*idx1 < *idx2) -+ return -1; -+ else if (*idx1 > *idx2) -+ return 1; -+ return 0; -+} -+ - /* Store new ELF into FILE. debug_sections array contains - new_data/new_size pairs where needed. */ - static int -@@ -10090,7 +10110,14 @@ write_dso (DSO *dso, const char *file, struct stat *st) - if (off < min_shoff) - min_shoff = off; - for (j = 1; j < dso->ehdr.e_shnum; ++j) -- if (dso->shdr[j].sh_offset > off) -+ if (dso->shdr[j].sh_offset > off -+ /* Do not adjust SHT_NOBITS sh_offset here, the kernel -+ for example lays out those in the middle of some -+ other sections which may cause their offset to wrap -+ around zero. -+ ??? Now in theory not adjusting means we might end up -+ with those having a higher offset than any other section. */ -+ && dso->shdr[j].sh_type != SHT_NOBITS) - dso->shdr[j].sh_offset += diff; - if (ehdr.e_shoff > off) - ehdr.e_shoff += diff; -@@ -10123,6 +10150,7 @@ write_dso (DSO *dso, const char *file, struct stat *st) - - if (min_shoff != ~(GElf_Off) 0) - { -+ /* Any section needs sh_offset adjustment to meet sh_addralign? */ - for (j = 1; j < dso->ehdr.e_shnum; ++j) - if (dso->shdr[j].sh_offset >= min_shoff - && dso->shdr[j].sh_addralign > 1 -@@ -10133,21 +10161,34 @@ write_dso (DSO *dso, const char *file, struct stat *st) - && (ehdr.e_shoff & (ehdr.e_ident[EI_CLASS] == ELFCLASS64 - ? 7 : 3)) != 0)) - { -+ /* Compute a section index list sorted after sh_offset. */ -+ int *shdrmap = alloca (dso->ehdr.e_shnum * sizeof (int)); -+ for (j = 0; j < dso->ehdr.e_shnum; ++j) -+ shdrmap[j] = j; -+ shdr_sort_compar_dso = dso; -+ qsort (shdrmap, dso->ehdr.e_shnum, sizeof (int), -+ shdr_sort_compar); -+ shdr_sort_compar_dso = NULL; -+ - /* Need to fix up sh_offset/e_shoff. Punt if all the sections - >= min_shoff aren't non-ALLOC. */ - GElf_Off last_shoff = 0; - int k = -1; - bool shdr_placed = false; - for (j = 1; j < dso->ehdr.e_shnum; ++j) -- if (dso->shdr[j].sh_offset < min_shoff && !last_shoff) -+ if (dso->shdr[shdrmap[j]].sh_offset < min_shoff && !last_shoff) -+ continue; -+ else if (dso->shdr[shdrmap[j]].sh_type == SHT_NOBITS) -+ /* NOBITS are just left in place where they are and their -+ sh_size does not matter. */ - continue; -- else if ((dso->shdr[j].sh_flags & SHF_ALLOC) != 0) -+ else if ((dso->shdr[shdrmap[j]].sh_flags & SHF_ALLOC) != 0) - { - error (0, 0, "Allocatable section in %s after non-allocatable " - "ones", dso->filename); - return 1; - } -- else if (dso->shdr[j].sh_offset < last_shoff) -+ else if (dso->shdr[shdrmap[j]].sh_offset < last_shoff) - { - error (0, 0, "Section offsets in %s not monotonically " - "increasing", dso->filename); -@@ -10157,7 +10198,8 @@ write_dso (DSO *dso, const char *file, struct stat *st) - { - if (k == -1) - k = j; -- last_shoff = dso->shdr[j].sh_offset + dso->shdr[j].sh_size; -+ last_shoff = (dso->shdr[shdrmap[j]].sh_offset -+ + dso->shdr[shdrmap[j]].sh_size); - } - last_shoff = min_shoff; - for (j = k; j <= dso->ehdr.e_shnum; ++j) -@@ -10165,7 +10207,7 @@ write_dso (DSO *dso, const char *file, struct stat *st) - if (!shdr_placed - && ehdr.e_shoff >= min_shoff - && (j == dso->ehdr.e_shnum -- || ehdr.e_shoff < dso->shdr[j].sh_offset)) -+ || ehdr.e_shoff < dso->shdr[shdrmap[j]].sh_offset)) - { - if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) - ehdr.e_shoff = (last_shoff + 7) & -8; -@@ -10176,13 +10218,18 @@ write_dso (DSO *dso, const char *file, struct stat *st) - } - if (j == dso->ehdr.e_shnum) - break; -- dso->shdr[j].sh_offset = last_shoff; -- if (dso->shdr[j].sh_addralign > 1) -- dso->shdr[j].sh_offset -- = (last_shoff + dso->shdr[j].sh_addralign - 1) -- & ~(dso->shdr[j].sh_addralign - (GElf_Off) 1); -- last_shoff = dso->shdr[j].sh_offset + dso->shdr[j].sh_size; -- if (addsec != -1 && j == addsec) -+ /* Do not touch SHT_NOBITS section offsets and more importantly -+ do not account for their size. */ -+ if (dso->shdr[shdrmap[j]].sh_type == SHT_NOBITS) -+ continue; -+ dso->shdr[shdrmap[j]].sh_offset = last_shoff; -+ if (dso->shdr[shdrmap[j]].sh_addralign > 1) -+ dso->shdr[shdrmap[j]].sh_offset -+ = (last_shoff + dso->shdr[shdrmap[j]].sh_addralign - 1) -+ & ~(dso->shdr[shdrmap[j]].sh_addralign - (GElf_Off) 1); -+ last_shoff = (dso->shdr[shdrmap[j]].sh_offset -+ + dso->shdr[shdrmap[j]].sh_size); -+ if (addsec != -1 && shdrmap[j] == addsec) - last_shoff += addsize; - } - } diff --git a/dwz-0.12.tar.xz b/dwz-0.12.tar.xz deleted file mode 100644 index 0feaff1..0000000 --- a/dwz-0.12.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:94fb5acf0650428eb153b3638974ccbb2f3fedecc372be53d21d6b328263de32 -size 91116 diff --git a/dwz-0.13.tar.xz b/dwz-0.13.tar.xz new file mode 100644 index 0000000..02bf0e9 --- /dev/null +++ b/dwz-0.13.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8da2495d666ba94c1d9b0eca0799e32fc4553d5cbcc8eadfe90d7ca48cf4f5b0 +size 113616 diff --git a/dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch b/dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch deleted file mode 100644 index f12f1ab..0000000 --- a/dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch +++ /dev/null @@ -1,57 +0,0 @@ -[low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc - -Function read_exprloc contains a loop that marks all parents of a -DW_OP_GNU_parameter_ref reference with CK_BAD. The loop however has no -private loop variable, so the ref variable, initially pointing to the -referenced DIE, ends up after the loop pointing to the root parent of the -reference instead. Consequently, the code after the loop, intended to be -executed for the referenced DIE, is instead executed for the root parent of -the referenced DIE. - -Fix this by moving the loop alap. - -2019-02-14 Tom de Vries - - PR dwz/24195 - * dwz.c (read_exprloc): Move loop marking parents with CK_BAD alap. - ---- - dwz.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git a/dwz.c b/dwz.c -index d348418..6e6b6fb 100644 ---- a/dwz.c -+++ b/dwz.c -@@ -1492,6 +1492,15 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, - } - if (op == DW_OP_call2) - ref->die_op_call2_referenced = 1; -+ if (unlikely (low_mem)) -+ { -+ ref->die_referenced = 1; -+ /* As .debug_loc adjustment is done after -+ write_info finishes, we need to keep the referenced -+ DIEs around uncollapsed. */ -+ if (need_adjust) -+ ref->die_intercu_referenced = 1; -+ } - if (ref->die_ck_state == CK_KNOWN) - { - ref->die_ck_state = CK_BAD; -@@ -1504,15 +1513,6 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, - } - else - ref->die_ck_state = CK_BAD; -- if (unlikely (low_mem)) -- { -- ref->die_referenced = 1; -- /* As .debug_loc adjustment is done after -- write_info finishes, we need to keep the referenced -- DIEs around uncollapsed. */ -- if (need_adjust) -- ref->die_intercu_referenced = 1; -- } - die->die_ck_state = CK_BAD; - if (need_adjust) - *need_adjust = true; diff --git a/dwz.changes b/dwz.changes index 656e998..593345a 100644 --- a/dwz.changes +++ b/dwz.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries + +- DWZ 0.13 update: + * Dropped patches: + - dwz-0.12-ignore-nobits.patch + - dwz-0.12-DW_OP_GNU_variable_value.patch + - dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch + * Added BuildRequires for dejagnu, elfutils, gdb and binutils-gold. + * Add %check +- Add URL tag + ------------------------------------------------------------------- Mon Feb 18 14:31:42 UTC 2019 - tdevries@suse.com diff --git a/dwz.spec b/dwz.spec index b4b2238..ef600e6 100644 --- a/dwz.spec +++ b/dwz.spec @@ -17,7 +17,7 @@ Name: dwz -Version: 0.12 +Version: 0.13 Release: 0 Summary: DWARF optimization and duplicate removal tool #Git-Clone: git://sourceware.org/git/dwz @@ -25,11 +25,13 @@ Summary: DWARF optimization and duplicate removal tool License: GPL-2.0-or-later AND LGPL-2.0-or-later Group: Development/Tools/Building Source: %{name}-%{version}.tar.xz -Patch0: dwz-0.12-ignore-nobits.patch -Patch1: dwz-0.12-DW_OP_GNU_variable_value.patch -Patch2: dwz-low-mem-Fix-DW_OP_GNU_parameter_ref-handling-in-read_exprloc.patch +Url: https://sourceware.org/dwz/ BuildRequires: libelf-devel BuildRequires: xz +BuildRequires: dejagnu +BuildRequires: elfutils +BuildRequires: gdb +BuildRequires: binutils-gold %description dwz optimizes DWARF debugging information contained in ELF shared @@ -51,13 +53,13 @@ is needed. %prep %setup -q -n %{name} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}" +%check +make -k check + %install %make_install From 0274f6c73ce5ab4ea684305f24a577875b7721dc1bbf7be0061e9b67c44de5c1 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 13 Aug 2019 10:24:27 +0000 Subject: [PATCH 2/3] Accepting request 723035 from home:tomdevries:branches:devel:tools:compiler - Split off dwz-testsuite package using multibuild, to remove build cycle - Don't require binutils-gold for riscv64 OBS-URL: https://build.opensuse.org/request/show/723035 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=16 --- _multibuild | 3 +++ dwz.changes | 7 +++++++ dwz.spec | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 _multibuild diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..964176c --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + testsuite + diff --git a/dwz.changes b/dwz.changes index 593345a..e92be97 100644 --- a/dwz.changes +++ b/dwz.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries + +- Split off dwz-testsuite package using multibuild, to remove build + cycle +- Don't require binutils-gold for riscv64 + ------------------------------------------------------------------- Fri Aug 2 10:43:02 UTC 2019 - Tom de Vries diff --git a/dwz.spec b/dwz.spec index ef600e6..9f6bd71 100644 --- a/dwz.spec +++ b/dwz.spec @@ -15,24 +15,57 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +%define flavor @BUILD_FLAVOR@%{nil} -Name: dwz +%if "%flavor" == "testsuite" +%define build_main 0 +%define build_testsuite 1 +%else +%define build_main 1 +%define build_testsuite 0 +%endif + +%if %{build_testsuite} +%define debug_package %{nil} +%endif + +%if %{build_main} +%define name_suffix %{nil} +%else +%define name_suffix -%{flavor} +%endif + +Name: dwz%{name_suffix} Version: 0.13 Release: 0 +%if %{build_main} Summary: DWARF optimization and duplicate removal tool +%endif +%if %{build_testsuite} +Summary: Testsuite results from DWZ +%endif #Git-Clone: git://sourceware.org/git/dwz #Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary License: GPL-2.0-or-later AND LGPL-2.0-or-later Group: Development/Tools/Building -Source: %{name}-%{version}.tar.xz +Source: dwz-%{version}.tar.xz Url: https://sourceware.org/dwz/ BuildRequires: libelf-devel BuildRequires: xz +%if %{build_testsuite} BuildRequires: dejagnu BuildRequires: elfutils BuildRequires: gdb +%ifnarch riscv64 BuildRequires: binutils-gold +%endif +%endif +%if !%{build_main} +NoSource: 0 +%endif + +%if %{build_main} %description dwz optimizes DWARF debugging information contained in ELF shared libraries and executables for size, by replacing DWARF information @@ -50,22 +83,41 @@ When not using the -m option (multifile mode), GDB CVS snapshot (soon to be 7.5) is sufficient, when using -m option, GDB from a git branch http://sources.redhat.com/git/?p=archer.git;a=shortlog;h=refs/heads/archer-tromey-dwz-multifile is needed. +%endif + +%if %{build_testsuite} +%description +This package contains the testsuite results from DWZ. +%endif %prep -%setup -q -n %{name} +%setup -q -n dwz %build make %{?_smp_mflags} CFLAGS="%{optflags}" %check +%if %{build_testsuite} make -k check +%endif %install +%if %{build_main} %make_install +%endif +%if %{build_main} %files %license COPYING %{_bindir}/dwz %{_mandir}/man1/dwz.1%{?ext_man} +%endif + +%if %{build_testsuite} +%files +%defattr(-,root,root) +%doc dwz.sum +%doc dwz.log +%endif %changelog From 51a83207a7cf0b33f358555df63cd250c4ec50aea3610fc4738fc31fcc21e216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20V=C3=B6gl?= Date: Mon, 19 Aug 2019 10:25:49 +0000 Subject: [PATCH 3/3] Accepting request 724022 from home:tomdevries:branches:devel:tools:compiler - Fix copyright years in --version message: * dwz-update-version-copyright-message.patch - source services update OBS-URL: https://build.opensuse.org/request/show/724022 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=17 --- dwz-update-version-copyright-message.patch | 294 +++++++++++++++++++++ dwz.changes | 6 + dwz.spec | 12 +- 3 files changed, 309 insertions(+), 3 deletions(-) create mode 100644 dwz-update-version-copyright-message.patch diff --git a/dwz-update-version-copyright-message.patch b/dwz-update-version-copyright-message.patch new file mode 100644 index 0000000..0353a39 --- /dev/null +++ b/dwz-update-version-copyright-message.patch @@ -0,0 +1,294 @@ +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 + + * 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. + +--- + 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(-) + +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/dwz.changes b/dwz.changes index e92be97..9c342c7 100644 --- a/dwz.changes +++ b/dwz.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 16 11:26:06 UTC 2019 - Tom de Vries + +- Fix copyright years in --version message: + * dwz-update-version-copyright-message.patch + ------------------------------------------------------------------- Tue Aug 13 09:29:02 UTC 2019 - Tom de Vries diff --git a/dwz.spec b/dwz.spec index 9f6bd71..3a6179e 100644 --- a/dwz.spec +++ b/dwz.spec @@ -12,9 +12,10 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # + %define flavor @BUILD_FLAVOR@%{nil} %if "%flavor" == "testsuite" @@ -40,14 +41,16 @@ Version: 0.13 Release: 0 %if %{build_main} Summary: DWARF optimization and duplicate removal tool +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building %endif %if %{build_testsuite} Summary: Testsuite results from DWZ +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: Development/Tools/Building %endif #Git-Clone: git://sourceware.org/git/dwz #Git-Web: https://sourceware.org/git/?p=dwz.git;a=summary -License: GPL-2.0-or-later AND LGPL-2.0-or-later -Group: Development/Tools/Building Source: dwz-%{version}.tar.xz Url: https://sourceware.org/dwz/ BuildRequires: libelf-devel @@ -65,6 +68,8 @@ BuildRequires: binutils-gold NoSource: 0 %endif +Patch1: dwz-update-version-copyright-message.patch + %if %{build_main} %description dwz optimizes DWARF debugging information contained in ELF shared @@ -92,6 +97,7 @@ This package contains the testsuite results from DWZ. %prep %setup -q -n dwz +%patch1 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}"