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