summaryrefslogtreecommitdiffstats
path: root/testsuite/dwz.tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testsuite/dwz.tests/cycle.c13
-rw-r--r--testsuite/dwz.tests/cycle.sh36
-rw-r--r--testsuite/dwz.tests/decl.cc3
-rw-r--r--testsuite/dwz.tests/def.cc11
-rw-r--r--testsuite/dwz.tests/def.h10
-rw-r--r--testsuite/dwz.tests/def2.cc9
-rw-r--r--testsuite/dwz.tests/devel-ignore-locus.sh27
-rw-r--r--testsuite/dwz.tests/devel-ignore-size.sh29
-rw-r--r--testsuite/dwz.tests/devel-trace.sh5
-rw-r--r--testsuite/dwz.tests/dw2-skip-prologue.S403
-rw-r--r--testsuite/dwz.tests/dw2-skip-prologue.c61
-rw-r--r--testsuite/dwz.tests/dwz-tests.exp145
-rw-r--r--testsuite/dwz.tests/dwz.sh7
-rw-r--r--testsuite/dwz.tests/eu-strip-unstrip-multifile.sh18
-rw-r--r--testsuite/dwz.tests/eu-strip-unstrip.sh11
-rwxr-xr-xtestsuite/dwz.tests/execs.xz/hello-ld-2.26.1.xzbin0 -> 2380 bytes
-rwxr-xr-xtestsuite/dwz.tests/execs.xz/hello-leap-15.0.xzbin0 -> 3996 bytes
-rw-r--r--testsuite/dwz.tests/gdb-add-index.sh15
-rw-r--r--testsuite/dwz.tests/gold-gdb-index.sh7
-rw-r--r--testsuite/dwz.tests/hardlink-multifile.sh15
-rw-r--r--testsuite/dwz.tests/hardlink.sh11
-rw-r--r--testsuite/dwz.tests/hello.c8
-rw-r--r--testsuite/dwz.tests/help.sh13
-rw-r--r--testsuite/dwz.tests/illegal-option.sh25
-rw-r--r--testsuite/dwz.tests/implptr-64bit-d2o4a8r8t0.S157
-rw-r--r--testsuite/dwz.tests/ld-2.26.1-multifile.sh14
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-0.sh13
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh23
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-at-limit.sh18
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-none.sh13
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-one-above.sh18
-rw-r--r--testsuite/dwz.tests/low-mem-die-limit-one-below.sh18
-rw-r--r--testsuite/dwz.tests/low-mem.sh7
-rw-r--r--testsuite/dwz.tests/main.c25
-rw-r--r--testsuite/dwz.tests/max-die-limit-none.sh7
-rw-r--r--testsuite/dwz.tests/min-2.c5
-rw-r--r--testsuite/dwz.tests/min.c7
-rw-r--r--testsuite/dwz.tests/multifile-name.sh12
-rw-r--r--testsuite/dwz.tests/multifile-relative.sh12
-rw-r--r--testsuite/dwz.tests/multifile.sh12
-rw-r--r--testsuite/dwz.tests/objcopy-eu-unstrip-multifile.sh39
-rw-r--r--testsuite/dwz.tests/objcopy-eu-unstrip.sh35
-rw-r--r--testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh18
-rw-r--r--testsuite/dwz.tests/objcopy-strip-debug.sh30
-rw-r--r--testsuite/dwz.tests/odr-2.cc20
-rw-r--r--testsuite/dwz.tests/odr-class-ns.sh29
-rw-r--r--testsuite/dwz.tests/odr-class.sh29
-rw-r--r--testsuite/dwz.tests/odr-def-decl.sh19
-rw-r--r--testsuite/dwz.tests/odr-loc-2.cc14
-rw-r--r--testsuite/dwz.tests/odr-loc.cc19
-rw-r--r--testsuite/dwz.tests/odr-loc.sh39
-rwxr-xr-xtestsuite/dwz.tests/odr-struct-multifile.sh61
-rw-r--r--testsuite/dwz.tests/odr-struct-ns.sh49
-rw-r--r--testsuite/dwz.tests/odr-struct.sh49
-rw-r--r--testsuite/dwz.tests/odr-union-ns.sh29
-rw-r--r--testsuite/dwz.tests/odr-union.sh29
-rw-r--r--testsuite/dwz.tests/odr.cc26
-rw-r--r--testsuite/dwz.tests/odr.h11
-rw-r--r--testsuite/dwz.tests/pointer-size.c8
-rw-r--r--testsuite/dwz.tests/pr24170.sh25
-rw-r--r--testsuite/dwz.tests/pr24171.sh15
-rw-r--r--testsuite/dwz.tests/pr24172.sh14
-rw-r--r--testsuite/dwz.tests/pr24173.sh16
-rw-r--r--testsuite/dwz.tests/pr24174.sh24
-rw-r--r--testsuite/dwz.tests/pr24341.sh17
-rw-r--r--testsuite/dwz.tests/pr24468.sh19
-rw-r--r--testsuite/dwz.tests/pr24542.sh15
-rw-r--r--testsuite/dwz.tests/pr24747.sh7
-rw-r--r--testsuite/dwz.tests/pr24771.sh9
-rw-r--r--testsuite/dwz.tests/pr24823.sh25
-rw-r--r--testsuite/dwz.tests/pr25109.sh6
-rw-r--r--testsuite/dwz.tests/pr27463.sh6
-rw-r--r--testsuite/dwz.tests/py-section-script.s393
-rw-r--r--testsuite/dwz.tests/regular-o.sh9
-rw-r--r--testsuite/dwz.tests/regular.sh7
-rw-r--r--testsuite/dwz.tests/save-temps.sh20
-rw-r--r--testsuite/dwz.tests/start.c3
-rw-r--r--testsuite/dwz.tests/too-many-dies.sh16
-rw-r--r--testsuite/dwz.tests/twice-hardlink.sh31
-rw-r--r--testsuite/dwz.tests/twice-multifile.sh34
-rw-r--r--testsuite/dwz.tests/twice.sh28
-rw-r--r--testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh15
-rw-r--r--testsuite/dwz.tests/two-files-too-many-dies-2.sh22
-rw-r--r--testsuite/dwz.tests/two-files-too-many-dies.sh17
-rw-r--r--testsuite/dwz.tests/two-typedef-2.c6
-rw-r--r--testsuite/dwz.tests/two-typedef.c11
-rw-r--r--testsuite/dwz.tests/two-typedef.h3
-rw-r--r--testsuite/dwz.tests/varval.S515
-rw-r--r--testsuite/dwz.tests/varval.c33
-rw-r--r--testsuite/dwz.tests/version.sh9
90 files changed, 3166 insertions, 0 deletions
diff --git a/testsuite/dwz.tests/cycle.c b/testsuite/dwz.tests/cycle.c
new file mode 100644
index 0000000..4795a79
--- /dev/null
+++ b/testsuite/dwz.tests/cycle.c
@@ -0,0 +1,13 @@
+struct s;
+
+struct s {
+ struct s *p;
+};
+
+struct s var;
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/cycle.sh b/testsuite/dwz.tests/cycle.sh
new file mode 100644
index 0000000..ce42521
--- /dev/null
+++ b/testsuite/dwz.tests/cycle.sh
@@ -0,0 +1,36 @@
+readelf_flags=""
+if readelf -h 2>&1 | grep -q "\-wN"; then
+ readelf_flags=-wN
+fi
+
+cp $execs/cycle 1
+
+# Using mode 3 in checksum_die_ref.
+$execs/dwz-for-test 1 -o 1.z --devel-dump-dies 2> DUMP.1
+rm -f 1.z
+
+# Skipping mode 3 in checksum_die_ref.
+$execs/dwz-for-test 1 -o 1.z --devel-dump-dies --devel-no-checksum-cycle-opt 2> DUMP.2
+rm -f 1.z
+
+# Verify that mode 3 and mode 4 have different checksums.
+grep " s structure_type" DUMP.1 > LINE.1
+grep " s structure_type" DUMP.2 > LINE.2
+! diff -q LINE.1 LINE.2
+rm -f DUMP.1 DUMP.2 LINE.1 LINE.2
+
+# Verify that dwz actually works with --devel-no-checksum-cycle-opt.
+cp 1 2
+$execs/dwz-for-test -m 3 1 2 --devel-no-checksum-cycle-opt --devel-ignore-size
+
+cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*: s$")
+[ $cnt -eq 1 ]
+
+# Even with -wN readelf 2.38-15.fc37 follows and prints the contents
+# of the alt file. So make sure it cannot do that by removing it.
+rm 3
+
+cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*: s$" || true)
+[ $cnt -eq 0 ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/decl.cc b/testsuite/dwz.tests/decl.cc
new file mode 100644
index 0000000..4953853
--- /dev/null
+++ b/testsuite/dwz.tests/decl.cc
@@ -0,0 +1,3 @@
+class ao_ref;
+
+ao_ref *p3;
diff --git a/testsuite/dwz.tests/def.cc b/testsuite/dwz.tests/def.cc
new file mode 100644
index 0000000..8645b9c
--- /dev/null
+++ b/testsuite/dwz.tests/def.cc
@@ -0,0 +1,11 @@
+#include "def.h"
+
+ao_ref *p1;
+
+int
+main (void)
+{
+ ao_ref *p1 = new ao_ref;
+ return 0;
+}
+
diff --git a/testsuite/dwz.tests/def.h b/testsuite/dwz.tests/def.h
new file mode 100644
index 0000000..dc3a602
--- /dev/null
+++ b/testsuite/dwz.tests/def.h
@@ -0,0 +1,10 @@
+class bla {
+ int a;
+ public:
+ bla() { a = 1; }
+};
+
+class ao_ref
+{
+ bla a;
+};
diff --git a/testsuite/dwz.tests/def2.cc b/testsuite/dwz.tests/def2.cc
new file mode 100644
index 0000000..794933f
--- /dev/null
+++ b/testsuite/dwz.tests/def2.cc
@@ -0,0 +1,9 @@
+#include "def.h"
+
+ao_ref *p2;
+
+void
+foo (void)
+{
+ p2 = new ao_ref;
+}
diff --git a/testsuite/dwz.tests/devel-ignore-locus.sh b/testsuite/dwz.tests/devel-ignore-locus.sh
new file mode 100644
index 0000000..a8b2dcd
--- /dev/null
+++ b/testsuite/dwz.tests/devel-ignore-locus.sh
@@ -0,0 +1,27 @@
+cp $execs/two-typedef 1
+
+cnt=$(readelf -wi 1 \
+ | grep 'DW_AT_name.*: aaa' \
+ | wc -l)
+
+[ $cnt -eq 2 ]
+
+$execs/dwz-for-test 1 2>/dev/null
+
+cnt=$(readelf -wi 1 \
+ | grep 'DW_AT_name.*: aaa' \
+ | wc -l)
+
+[ $cnt -eq 2 ]
+
+cp $execs/two-typedef 1
+
+$execs/dwz-for-test --devel-ignore-locus --devel-ignore-size 1
+
+cnt=$(readelf -wi 1 \
+ | grep 'DW_AT_name.*: aaa' \
+ | wc -l)
+
+[ $cnt -eq 1 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/devel-ignore-size.sh b/testsuite/dwz.tests/devel-ignore-size.sh
new file mode 100644
index 0000000..a30684f
--- /dev/null
+++ b/testsuite/dwz.tests/devel-ignore-size.sh
@@ -0,0 +1,29 @@
+cp $execs/min 1
+
+cnt=$(readelf -wi 1 \
+ | grep '(DW_TAG_partial_unit' \
+ | wc -l)
+
+[ $cnt -eq 0 ]
+
+$execs/dwz-for-test 1 2>/dev/null
+
+cnt=$(readelf -wi 1 \
+ | grep '(DW_TAG_partial_unit' \
+ | wc -l)
+
+if [ $cnt -ne 0 ]; then
+ exit 77
+fi
+
+cp $execs/min 1
+
+$execs/dwz-for-test --devel-ignore-size 1
+
+cnt=$(readelf -wi 1 \
+ | grep '(DW_TAG_partial_unit' \
+ | wc -l)
+
+[ $cnt -gt 0 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/devel-trace.sh b/testsuite/dwz.tests/devel-trace.sh
new file mode 100644
index 0000000..50c4a3d
--- /dev/null
+++ b/testsuite/dwz.tests/devel-trace.sh
@@ -0,0 +1,5 @@
+cp $execs/hello 1
+
+$execs/dwz-for-test --devel-trace 1 2>/dev/null
+
+rm -f 1
diff --git a/testsuite/dwz.tests/dw2-skip-prologue.S b/testsuite/dwz.tests/dw2-skip-prologue.S
new file mode 100644
index 0000000..4d2e198
--- /dev/null
+++ b/testsuite/dwz.tests/dw2-skip-prologue.S
@@ -0,0 +1,403 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011-2019 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/>.
+
+ This was copied from the git://sourceware.org/git/binutils-gdb.git
+ repository, file gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S. */
+
+#if PTRBITS == 64
+# define PTRBYTE .8byte
+#elif PTRBITS == 32
+# define PTRBYTE .4byte
+#else
+# error "Unsupported pointer size"
+#endif
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte PTRBITS / 8 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .4byte .Lline1_begin /* DW_AT_stmt_list */
+ PTRBYTE func_start /* DW_AT_low_pc */
+ PTRBYTE func_end /* DW_AT_high_pc */
+ .ascii "main.c\0" /* DW_AT_name */
+ .ascii "GNU C 4.5.0\0" /* DW_AT_producer must be >= 4.5 */
+ .byte 2 /* DW_AT_language (DW_LANG_C) */
+
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "func\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ PTRBYTE func_start /* DW_AT_low_pc */
+ PTRBYTE func_end /* DW_AT_high_pc */
+
+/* GDB `has_loclist' detection of -O2 -g code needs to see a DW_AT_location
+ location list. There may exist -O2 -g CUs still not needing/using any such
+ location list - exactly like this CU. Make one up. */
+
+ .uleb128 0x7 /* (DIE (0x42) DW_TAG_formal_parameter) */
+ .ascii "param\0" /* DW_AT_name */
+ .4byte .Ltype_int - .Lcu1_begin /* DW_AT_type */
+ .4byte loclist /* DW_AT_location */
+
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "inlined\0" /* DW_AT_name */
+ PTRBYTE func0 /* DW_AT_low_pc */
+ PTRBYTE func1 /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 8 /* DW_AT_call_line */
+
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "inlined2\0" /* DW_AT_name */
+ PTRBYTE func2 /* DW_AT_low_pc */
+ PTRBYTE func3 /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 11 /* DW_AT_call_line */
+
+#ifdef INLINED
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "otherinline\0" /* DW_AT_name */
+ PTRBYTE func3 /* DW_AT_low_pc */
+ PTRBYTE func_end /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 9 /* DW_AT_call_line */
+#endif
+
+#ifdef LEXICAL
+ .uleb128 5 /* Abbrev: DW_TAG_lexical_block */
+ PTRBYTE func3 /* DW_AT_low_pc */
+ PTRBYTE func_end /* DW_AT_high_pc */
+
+ /* GDB would otherwise ignore the DW_TAG_lexical_block. */
+ .uleb128 6 /* Abbrev: DW_TAG_variable */
+ .ascii "lexicalvar\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+
+ .byte 0 /* End of children of DW_TAG_lexical_block */
+#endif
+
+ .byte 0 /* End of children of DW_TAG_subprogram */
+
+/* Simulate `fund' is also named `func' so that the function name matches and
+ fund's SAL is not discarded in expand_line_sal_maybe. */
+
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "func\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ PTRBYTE fund_start /* DW_AT_low_pc */
+ PTRBYTE fund_end /* DW_AT_high_pc */
+
+ .byte 0 /* End of children of DW_TAG_subprogram */
+
+.Ltype_int:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+ .section .debug_loc
+loclist:
+ /* Reset the location list base address first. */
+ .4byte -1, 0
+
+ PTRBYTE func_start, func_end
+ .2byte 2f-1f
+1: .byte 0x50 /* DW_OP_reg0 */
+2:
+ /* Location list end. */
+ .4byte 0, 0
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x10 /* DW_AT_stmt_list */
+ .uleb128 0x6 /* DW_FORM_data4 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 4 /* Abbrev code */
+ .uleb128 0x1d /* DW_TAG_inlined_subroutine */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x20 /* DW_AT_inline */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x58 /* DW_AT_call_file */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x59 /* DW_AT_call_line */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 5 /* Abbrev code */
+ .uleb128 0x0b /* DW_TAG_lexical_block */
+ .byte 1 /* has_children */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 6 /* Abbrev code */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 0x7 /* (abbrev code) */
+ .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x02 /* (DW_AT_location) */
+ .uleb128 0x06 /* (DW_FORM_data4) */
+ .byte 0x0
+ .byte 0x0
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+/* Line table */
+ .section .debug_line
+.Lline1_begin:
+ .4byte .Lline1_end - .Lline1_start /* Initial length */
+.Lline1_start:
+ .2byte 2 /* Version */
+ .4byte .Lline1_lines - .Lline1_hdr /* header_length */
+.Lline1_hdr:
+ .byte 1 /* Minimum insn length */
+ .byte 1 /* default_is_stmt */
+ .byte 1 /* line_base */
+ .byte 1 /* line_range */
+ .byte 0x10 /* opcode_base */
+
+ /* Standard lengths */
+ .byte 0
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+
+ /* Include directories */
+ .byte 0
+
+ /* File names */
+ .ascii "main.c\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .ascii "other.c\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .byte 0
+
+.Lline1_lines:
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func_start
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 4 /* ... to 5 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func0
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func1
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func2
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -8 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func3
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE func_end
+
+/* Equivalent copy but renamed s/func/fund/. */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund_start
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 5 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund0
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund1
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund2
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -8 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund3
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ PTRBYTE fund_end
+
+/* Line numbering end. */
+
+ .byte 0 /* DW_LNE_end_of_sequence */
+ .uleb128 1
+ .byte 1
+
+.Lline1_end:
+ .section .note.GNU-stack,"",@progbits
diff --git a/testsuite/dwz.tests/dw2-skip-prologue.c b/testsuite/dwz.tests/dw2-skip-prologue.c
new file mode 100644
index 0000000..34b0a7c
--- /dev/null
+++ b/testsuite/dwz.tests/dw2-skip-prologue.c
@@ -0,0 +1,61 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011-2019 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/>.
+
+ This was copied from the git://sourceware.org/git/binutils-gdb.git
+ repository, file gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c. */
+
+static volatile int v;
+
+asm ("func_start: .globl func_start\n");
+static int
+func (void)
+{
+ v++;
+asm ("func0: .globl func0\n");
+ v++;
+asm ("func1: .globl func1\n");
+ v++;
+asm ("func2: .globl func2\n");
+ v++;
+asm ("func3: .globl func3\n");
+ return v;
+}
+asm ("func_end: .globl func_end\n");
+
+/* Equivalent copy but renamed s/func/fund/. */
+
+asm ("fund_start: .globl fund_start\n");
+static int
+fund (void)
+{
+ v++;
+asm ("fund0: .globl fund0\n");
+ v++;
+asm ("fund1: .globl fund1\n");
+ v++;
+asm ("fund2: .globl fund2\n");
+ v++;
+asm ("fund3: .globl fund3\n");
+ return v;
+}
+asm ("fund_end: .globl fund_end\n");
+
+int
+main (void)
+{
+ return func () + fund ();
+}
diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
new file mode 100644
index 0000000..811767f
--- /dev/null
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -0,0 +1,145 @@
+set tests [find $srcdir/$subdir *.sh]
+
+set pwd [pwd]
+
+set env(PATH) $srcdir/scripts:$::env(PATH)
+set env(execs) $pwd
+
+exec mkdir -p $pwd/testsuite/dwz.tests/execs
+exec $srcdir/scripts/xunzip-dir.sh \
+ $srcdir/dwz.tests/execs.xz \
+ $pwd/testsuite/dwz.tests/execs
+
+foreach test $tests {
+ global runtests
+
+ set basename [exec basename $test]
+
+ if ![runtest_file_p $runtests $basename] {
+ continue
+ }
+
+ set required_execs []
+ if { $basename == "pr24173.sh" } {
+ lappend required_execs "py-section-script"
+ }
+ if { $basename == "pr24341.sh" } {
+ if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } {
+ # Some error occurred in the supported test, f.i. DWARF in min
+ # unsupported by readelf.
+ unsupported "$test"
+ continue
+ }
+ if { $matches != 2 } {
+ # The exec min is used for the regression test for pr24341, but it
+ # only functions as such if the DWARF only contains the CUs of the
+ # test-case itself.
+ unsupported "$test"
+ continue
+ }
+ }
+ if { $basename == "pr24172.sh" } {
+ if { ![istarget x86_64-*-*] } {
+ unsupported "$test"
+ continue
+ }
+ lappend required_execs "dw2-skip-prologue"
+ }
+ if { $basename == "pr24170.sh" } {
+ lappend required_execs "implptr-64bit-d2o4a8r8t0"
+ }
+ if { $basename == "gold-gdb-index.sh" } {
+ lappend required_execs "hello-gold-gdb-index"
+ }
+ if { $basename == "pr24747.sh" } {
+ lappend required_execs "start-gold"
+ }
+ if { $basename == "pr24771.sh" } {
+ lappend required_execs "hello-gnu-pubnames"
+ }
+ if { $basename == "pr24823.sh" } {
+ lappend required_execs "varval"
+ }
+ if { ![istarget x86_64-*-*] } {
+ if { $basename == "pr24468.sh" } {
+ unsupported "$test"
+ continue
+ }
+ if { $basename == "ld-2.26.1-multifile.sh" } {
+ unsupported "$test"
+ continue
+ }
+ }
+ if { $basename == "gdb-add-index.sh" } {
+ if { [catch { exec which gdb-add-index } ] } {
+ unsupported "$test"
+ continue
+ }
+ }
+ if { [istarget mips*-*-*] } {
+ # elfutils don't have a MIPS backend (PR elfutils/24795), so eu-strip
+ # doesn't work as expected.
+ if { $basename == "eu-strip-unstrip.sh" || \
+ $basename == "eu-strip-unstrip-multifile.sh" || \
+ $basename == "pr24173.sh" } {
+ unsupported "$test"
+ 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 {
+ set exists [file exists $required_exec]
+ if { $exists == 0 } {
+ set unsupported 1
+ break
+ }
+ set size [file size $required_exec]
+ if { $size == 0 } {
+ set unsupported 1
+ break
+ }
+ }
+ if { $unsupported == 1 } {
+ unsupported "$test"
+ continue
+ }
+
+ set dir $pwd/tmp.$basename
+ exec rm -Rf $dir
+ exec mkdir $dir
+
+ cd $dir
+ if { [catch { exec sh -e $test } msg] } {
+ if { [lindex $::errorCode 0] == "CHILDSTATUS" && \
+ [lindex $::errorCode 2] == 77 } {
+ unsupported "$test"
+ exec rm -Rf $dir
+ } else {
+ puts "$msg"
+ fail "$test"
+ }
+ } else {
+ if { [file exists dwz.info ] } {
+ set info [exec cat dwz.info]
+ verbose -log "$test:" 1
+ verbose -log "$info" 1
+ exec rm -f dwz.info
+ }
+ set file_list [glob -nocomplain "$dir/*"]
+ if {[llength $file_list] != 0} {
+ puts "$dir is not empty"
+ fail "$test"
+ } else {
+ pass "$test"
+ exec rm -Rf $dir
+ }
+ }
+ cd $pwd
+}
diff --git a/testsuite/dwz.tests/dwz.sh b/testsuite/dwz.tests/dwz.sh
new file mode 100644
index 0000000..1cb16d2
--- /dev/null
+++ b/testsuite/dwz.tests/dwz.sh
@@ -0,0 +1,7 @@
+cp $execs/dwz-for-test 1
+
+dwz 1
+
+smaller-than.sh 1 $execs/dwz-for-test
+
+rm -f 1
diff --git a/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
new file mode 100644
index 0000000..afe0994
--- /dev/null
+++ b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
@@ -0,0 +1,18 @@
+cp $execs/hello 1
+cp $execs/hello 2
+
+eu-strip 1 -o 1.stripped -f 1.debug
+eu-strip 2 -o 2.stripped -f 2.debug
+
+dwz -m 3 1.debug 2.debug
+
+eu-unstrip 1.stripped 1.debug -o 1.unstripped
+eu-unstrip 2.stripped 2.debug -o 2.unstripped
+
+smaller-than.sh 1.unstripped 1
+smaller-than.sh 2.unstripped 2
+
+[ "$(gnu-debugaltlink-name.sh 1.unstripped)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2.unstripped)" = "3" ]
+
+rm -f 1 1.debug 1.stripped 1.unstripped 2 2.debug 2.stripped 2.unstripped 3
diff --git a/testsuite/dwz.tests/eu-strip-unstrip.sh b/testsuite/dwz.tests/eu-strip-unstrip.sh
new file mode 100644
index 0000000..ce3adad
--- /dev/null
+++ b/testsuite/dwz.tests/eu-strip-unstrip.sh
@@ -0,0 +1,11 @@
+cp $execs/hello 1
+
+eu-strip 1 -o 1.stripped -f 1.debug
+
+dwz 1.debug
+
+eu-unstrip 1.stripped 1.debug -o 1.unstripped
+
+smaller-than.sh 1.unstripped 1
+
+rm -f 1 1.debug 1.stripped 1.unstripped
diff --git a/testsuite/dwz.tests/execs.xz/hello-ld-2.26.1.xz b/testsuite/dwz.tests/execs.xz/hello-ld-2.26.1.xz
new file mode 100755
index 0000000..3514195
--- /dev/null
+++ b/testsuite/dwz.tests/execs.xz/hello-ld-2.26.1.xz
Binary files differ
diff --git a/testsuite/dwz.tests/execs.xz/hello-leap-15.0.xz b/testsuite/dwz.tests/execs.xz/hello-leap-15.0.xz
new file mode 100755
index 0000000..598c88e
--- /dev/null
+++ b/testsuite/dwz.tests/execs.xz/hello-leap-15.0.xz
Binary files differ
diff --git a/testsuite/dwz.tests/gdb-add-index.sh b/testsuite/dwz.tests/gdb-add-index.sh
new file mode 100644
index 0000000..3095efb
--- /dev/null
+++ b/testsuite/dwz.tests/gdb-add-index.sh
@@ -0,0 +1,15 @@
+cp $execs/hello 1
+
+# Redirect gdb-add-index stderr to stdout.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=29316
+gdb-add-index 1 2>&1
+
+readelf -S 1 | grep -q '\.gdb_index'
+
+dwz 1 -o 2
+
+readelf -S 2 | grep -q '\.gdb_index'
+
+smaller-than.sh 2 1
+
+rm -f 1 2
diff --git a/testsuite/dwz.tests/gold-gdb-index.sh b/testsuite/dwz.tests/gold-gdb-index.sh
new file mode 100644
index 0000000..eb2a164
--- /dev/null
+++ b/testsuite/dwz.tests/gold-gdb-index.sh
@@ -0,0 +1,7 @@
+cp ../hello-gold-gdb-index 1
+
+dwz 1
+
+smaller-than.sh 1 ../hello-gold-gdb-index
+
+rm -f 1
diff --git a/testsuite/dwz.tests/hardlink-multifile.sh b/testsuite/dwz.tests/hardlink-multifile.sh
new file mode 100644
index 0000000..160a7ed
--- /dev/null
+++ b/testsuite/dwz.tests/hardlink-multifile.sh
@@ -0,0 +1,15 @@
+cp $execs/hello 1
+ln 1 2
+cp $execs/hello 3
+
+dwz -h -m 4 1 2 3
+
+hardlinks-p.sh 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 3 $execs/hello
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "4" ]
+[ "$(gnu-debugaltlink-name.sh 3)" = "4" ]
+
+rm -f 1 2 3 4
diff --git a/testsuite/dwz.tests/hardlink.sh b/testsuite/dwz.tests/hardlink.sh
new file mode 100644
index 0000000..3a956b2
--- /dev/null
+++ b/testsuite/dwz.tests/hardlink.sh
@@ -0,0 +1,11 @@
+cp $execs/hello 1
+ln 1 2
+
+dwz -h 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 2 $execs/hello
+
+hardlinks-p.sh 1 2
+
+rm -f 1 2
diff --git a/testsuite/dwz.tests/hello.c b/testsuite/dwz.tests/hello.c
new file mode 100644
index 0000000..82d070e
--- /dev/null
+++ b/testsuite/dwz.tests/hello.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("hello\n");
+ return 0;
+}
diff --git a/testsuite/dwz.tests/help.sh b/testsuite/dwz.tests/help.sh
new file mode 100644
index 0000000..b4d5e28
--- /dev/null
+++ b/testsuite/dwz.tests/help.sh
@@ -0,0 +1,13 @@
+cp $execs/hello 1
+
+if dwz -? 1 2> dwz.err; status=$?; then
+ true
+fi
+
+[ $status -eq 1 ]
+
+grep -q "Usage:" dwz.err
+
+cmp 1 $execs/hello
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/illegal-option.sh b/testsuite/dwz.tests/illegal-option.sh
new file mode 100644
index 0000000..f767f4c
--- /dev/null
+++ b/testsuite/dwz.tests/illegal-option.sh
@@ -0,0 +1,25 @@
+cp $execs/hello 1
+
+if dwz -x 1 2> dwz.err; status=$?; then
+ true
+fi
+
+[ $status -eq 1 ]
+
+grep -q ": invalid option -- 'x'" dwz.err
+grep -q "Usage:" dwz.err
+
+cmp 1 $execs/hello
+
+if dwz --x 1 2> dwz.err; status=$?; then
+ true
+fi
+
+[ $status -eq 1 ]
+
+grep -q ": unrecognized option '--x'" dwz.err
+grep -q "Usage:" dwz.err
+
+cmp 1 $execs/hello
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/implptr-64bit-d2o4a8r8t0.S b/testsuite/dwz.tests/implptr-64bit-d2o4a8r8t0.S
new file mode 100644
index 0000000..08e1563
--- /dev/null
+++ b/testsuite/dwz.tests/implptr-64bit-d2o4a8r8t0.S
@@ -0,0 +1,157 @@
+/* This was generated using git://sourceware.org/git/binutils-gdb.git
+ repository, file gdb/testsuite/gdb.dwarf2/implptr-64bit.exp. */
+ .section .debug_info
+.Lcu1_begin:
+ .4byte .Lcu1_end - .Lcu1_start
+.Lcu1_start:
+ .2byte 2 /* Version */
+ .4byte .Labbrev1_begin /* Abbrevs */
+ .byte 8 /* Pointer size */
+ .uleb128 2 /* Abbrev (DW_TAG_compile_unit) */
+ .ascii "GNU C 4.4.3\0"
+ .sleb128 0x0001
+ .ascii "1.c\0"
+.Llabel3:
+ .uleb128 3 /* Abbrev (DW_TAG_base_type) */
+ .sleb128 4
+ .sleb128 0x5
+ .ascii "int\0"
+.Llabel1:
+ .uleb128 4 /* Abbrev (DW_TAG_structure_type) */
+ .ascii "s\0"
+ .sleb128 4
+ .uleb128 5 /* Abbrev (DW_TAG_member) */
+ .ascii "f\0"
+ .4byte .Llabel3 - .Lcu1_begin
+ .byte 0
+ .byte 0x0 /* Terminate children */
+.Llabel4:
+ .uleb128 6 /* Abbrev (DW_TAG_pointer_type) */
+ .sleb128 8
+ .4byte .Llabel1 - .Lcu1_begin
+.Llabel2:
+ .uleb128 7 /* Abbrev (DW_TAG_variable) */
+ .ascii "v\0"
+ .uleb128 .Lexpr_end6 - .Lexpr_start5/* expression */
+.Lexpr_start5:
+ .byte 0x9e /* DW_OP_implicit_value */
+ .uleb128 .Lvalue_end8 - .Lvalue_start7
+.Lvalue_start7:
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+.Lvalue_end8:
+.Lexpr_end6:
+ .8byte .Llabel1 - .Lcu1_begin
+ .uleb128 8 /* Abbrev (DW_TAG_subprogram) */
+ .ascii "main\0"
+ .8byte main
+ .8byte main+0x100
+ .8byte .Llabel3
+ .byte 1
+ .uleb128 9 /* Abbrev (DW_TAG_variable) */
+ .ascii "p\0"
+ .uleb128 .Lexpr_end10 - .Lexpr_start9/* expression */
+.Lexpr_start9:
+ .byte 0xf2 /* DW_OP_GNU_implicit_pointer */
+ .8byte .Llabel2
+ .sleb128 0
+.Lexpr_end10:
+ .8byte .Llabel4 - .Lcu1_begin
+ .byte 0x0 /* Terminate children */
+ .byte 0x0 /* Terminate children */
+.Lcu1_end:
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 2 /* Abbrev start */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 3 /* Abbrev start */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 4 /* Abbrev start */
+ .uleb128 0x13 /* DW_TAG_structure_type */
+ .byte 1 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 5 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0b /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 6 /* Abbrev start */
+ .uleb128 0x0f /* DW_TAG_pointer_type */
+ .byte 0 /* has_children */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 7 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x09 /* SPECIAL_expr */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x14 /* DW_FORM_ref8 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 8 /* Abbrev start */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x10 /* DW_FORM_ref_addr */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 9 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x09 /* SPECIAL_expr */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x14 /* DW_FORM_ref8 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .section .note.GNU-stack,"",@progbits
diff --git a/testsuite/dwz.tests/ld-2.26.1-multifile.sh b/testsuite/dwz.tests/ld-2.26.1-multifile.sh
new file mode 100644
index 0000000..a63253c
--- /dev/null
+++ b/testsuite/dwz.tests/ld-2.26.1-multifile.sh
@@ -0,0 +1,14 @@
+exec=../testsuite/dwz.tests/execs/hello-ld-2.26.1
+
+cp $exec 1
+cp 1 2
+
+dwz -m 3 1 2
+
+smaller-than.sh 1 $exec
+smaller-than.sh 2 $exec
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/low-mem-die-limit-0.sh b/testsuite/dwz.tests/low-mem-die-limit-0.sh
new file mode 100644
index 0000000..7105431
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-0.sh
@@ -0,0 +1,13 @@
+cp $execs/hello 1
+
+$execs/dwz-for-test \
+ -l0 \
+ --devel-trace \
+ 1 \
+ 2> dwz.err
+
+if grep -q "Compressing 1$" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh b/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh
new file mode 100644
index 0000000..ece4fd5
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-at-limit-multifile.sh
@@ -0,0 +1,23 @@
+cp $execs/hello 1
+cp 1 2
+
+count=$(readelf -wi 1 \
+ | grep '(DW_TAG' \
+ | wc -l)
+limit=$count
+
+if $execs/dwz-for-test \
+ -l$limit \
+ --devel-trace \
+ -m 3 1 2 \
+ 2> dwz.err; status=$?; then
+ true
+fi
+
+if grep -q "Hit low-mem die-limit" dwz.err; then
+ exit 1
+fi
+
+[ $status -eq 0 ]
+
+rm -f 1 2 3 dwz.err
diff --git a/testsuite/dwz.tests/low-mem-die-limit-at-limit.sh b/testsuite/dwz.tests/low-mem-die-limit-at-limit.sh
new file mode 100644
index 0000000..03ff273
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-at-limit.sh
@@ -0,0 +1,18 @@
+cp $execs/hello 1
+
+count=$(readelf -wi 1 \
+ | grep '(DW_TAG' \
+ | wc -l)
+limit=$count
+
+$execs/dwz-for-test \
+ -l$limit \
+ --devel-trace \
+ 1 \
+ 2> dwz.err
+
+if grep -q "Compressing 1 in low-mem mode" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/low-mem-die-limit-none.sh b/testsuite/dwz.tests/low-mem-die-limit-none.sh
new file mode 100644
index 0000000..20b8cad
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-none.sh
@@ -0,0 +1,13 @@
+cp $execs/hello 1
+
+$execs/dwz-for-test \
+ -lnone \
+ --devel-trace \
+ 1 \
+ 2> dwz.err
+
+if grep -q "Compressing 1 in low-mem mode" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/low-mem-die-limit-one-above.sh b/testsuite/dwz.tests/low-mem-die-limit-one-above.sh
new file mode 100644
index 0000000..9b9a6ff
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-one-above.sh
@@ -0,0 +1,18 @@
+cp $execs/hello 1
+
+count=$(readelf -wi 1 \
+ | grep '(DW_TAG' \
+ | wc -l)
+limit=$((count + 1))
+
+$execs/dwz-for-test \
+ -l$limit \
+ --devel-trace \
+ 1 \
+ 2> dwz.err
+
+if grep -q "Compressing 1 in low-mem mode" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/low-mem-die-limit-one-below.sh b/testsuite/dwz.tests/low-mem-die-limit-one-below.sh
new file mode 100644
index 0000000..4136336
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem-die-limit-one-below.sh
@@ -0,0 +1,18 @@
+cp $execs/hello 1
+
+count=$(readelf -wi 1 \
+ | grep '(DW_TAG' \
+ | wc -l)
+limit=$((count - 1))
+
+$execs/dwz-for-test \
+ -l$limit \
+ --devel-trace \
+ 1 \
+ 2> dwz.err
+
+if ! grep -q "Compressing 1 in low-mem mode" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/low-mem.sh b/testsuite/dwz.tests/low-mem.sh
new file mode 100644
index 0000000..e75a198
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem.sh
@@ -0,0 +1,7 @@
+cp $execs/hello 1
+
+dwz -l0 1
+
+smaller-than.sh 1 $execs/hello
+
+rm -f 1
diff --git a/testsuite/dwz.tests/main.c b/testsuite/dwz.tests/main.c
new file mode 100644
index 0000000..486b018
--- /dev/null
+++ b/testsuite/dwz.tests/main.c
@@ -0,0 +1,25 @@
+int
+main (void)
+{
+ 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 --git a/testsuite/dwz.tests/max-die-limit-none.sh b/testsuite/dwz.tests/max-die-limit-none.sh
new file mode 100644
index 0000000..f45d566
--- /dev/null
+++ b/testsuite/dwz.tests/max-die-limit-none.sh
@@ -0,0 +1,7 @@
+cp $execs/hello 1
+
+$execs/dwz-for-test \
+ -Lnone \
+ 1
+
+rm -f 1
diff --git a/testsuite/dwz.tests/min-2.c b/testsuite/dwz.tests/min-2.c
new file mode 100644
index 0000000..a1b61ce
--- /dev/null
+++ b/testsuite/dwz.tests/min-2.c
@@ -0,0 +1,5 @@
+int
+foo (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/min.c b/testsuite/dwz.tests/min.c
new file mode 100644
index 0000000..cd4ef42
--- /dev/null
+++ b/testsuite/dwz.tests/min.c
@@ -0,0 +1,7 @@
+extern int foo (void);
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/multifile-name.sh b/testsuite/dwz.tests/multifile-name.sh
new file mode 100644
index 0000000..31e73f2
--- /dev/null
+++ b/testsuite/dwz.tests/multifile-name.sh
@@ -0,0 +1,12 @@
+cp $execs/hello 1
+cp $execs/hello 2
+
+dwz -m 3 -M /xxx/yyy/3 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 2 $execs/hello
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "/xxx/yyy/3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "/xxx/yyy/3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/multifile-relative.sh b/testsuite/dwz.tests/multifile-relative.sh
new file mode 100644
index 0000000..7254206
--- /dev/null
+++ b/testsuite/dwz.tests/multifile-relative.sh
@@ -0,0 +1,12 @@
+cp $execs/hello 1
+cp $execs/hello 2
+
+dwz -m $(pwd -P)/3 -r 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 2 $execs/hello
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/multifile.sh b/testsuite/dwz.tests/multifile.sh
new file mode 100644
index 0000000..b5f6112
--- /dev/null
+++ b/testsuite/dwz.tests/multifile.sh
@@ -0,0 +1,12 @@
+cp $execs/hello 1
+cp $execs/hello 2
+
+dwz -m 3 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 2 $execs/hello
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/objcopy-eu-unstrip-multifile.sh b/testsuite/dwz.tests/objcopy-eu-unstrip-multifile.sh
new file mode 100644
index 0000000..15ed418
--- /dev/null
+++ b/testsuite/dwz.tests/objcopy-eu-unstrip-multifile.sh
@@ -0,0 +1,39 @@
+cp ../hello 1
+
+objcopy --only-keep-debug 1 1.debug
+objcopy --strip-debug 1 1.stripped
+
+if ! eu-unstrip 1.stripped 1.debug -o 1.unstripped; then
+ exit 77
+fi
+rm 1.unstripped
+
+cp 1.debug 2.debug
+
+if dwz -m 3 1.debug 2.debug 2> dwz.err; status=$?; then
+ true
+fi
+
+rm 2.debug
+
+if grep -q "dwz: Section overlap detected" dwz.err; then
+ exit 77
+fi
+
+[ $status -eq 0 ]
+
+version=$(eu-unstrip --version | head -n 1 | cut -d ' ' -f3)
+major=$(echo $version | sed 's%\..*%%')
+minor=$(echo $version | sed 's%.*\.%%')
+if [ $major -gt 0 ] || [ $minor -ge 168 ]; then
+ true
+else
+ exit 77
+fi
+
+eu-unstrip 1.stripped 1.debug -o 1.unstripped
+
+# An unstripped exec can end up larger than the original (PR elfutils/24809).
+#smaller-than.sh 1.unstripped 1
+
+rm -f 1 1.debug 1.stripped 1.unstripped 3 dwz.err
diff --git a/testsuite/dwz.tests/objcopy-eu-unstrip.sh b/testsuite/dwz.tests/objcopy-eu-unstrip.sh
new file mode 100644
index 0000000..18593d0
--- /dev/null
+++ b/testsuite/dwz.tests/objcopy-eu-unstrip.sh
@@ -0,0 +1,35 @@
+cp ../hello 1
+
+objcopy --only-keep-debug 1 1.debug
+objcopy --strip-debug 1 1.stripped
+
+if ! eu-unstrip 1.stripped 1.debug -o 1.unstripped; then
+ exit 77
+fi
+rm 1.unstripped
+
+if dwz 1.debug 2> dwz.err; status=$?; then
+ true
+fi
+
+if grep -q "dwz: Section overlap detected" dwz.err; then
+ exit 77
+fi
+
+[ $status -eq 0 ]
+
+version=$(eu-unstrip --version | head -n 1 | cut -d ' ' -f3)
+major=$(echo $version | sed 's%\..*%%')
+minor=$(echo $version | sed 's%.*\.%%')
+if [ $major -gt 0 ] || [ $minor -ge 168 ]; then
+ true
+else
+ exit 77
+fi
+
+eu-unstrip 1.stripped 1.debug -o 1.unstripped
+
+# An unstripped exec can end up larger than the original (PR elfutils/24809).
+#smaller-than.sh 1.unstripped 1
+
+rm -f 1 1.debug 1.stripped 1.unstripped dwz.err
diff --git a/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh b/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh
new file mode 100644
index 0000000..98ab12c
--- /dev/null
+++ b/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh
@@ -0,0 +1,18 @@
+objcopy --remove-section=.debug_abbrev $execs/hello 1
+
+cp 1 1.saved
+
+if dwz 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "\.debug_abbrev not present" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+cmp 1 1.saved
+
+rm -f 1 1.saved dwz.err
diff --git a/testsuite/dwz.tests/objcopy-strip-debug.sh b/testsuite/dwz.tests/objcopy-strip-debug.sh
new file mode 100644
index 0000000..a22ba3a
--- /dev/null
+++ b/testsuite/dwz.tests/objcopy-strip-debug.sh
@@ -0,0 +1,30 @@
+objcopy --strip-debug $execs/hello 1
+
+cp 1 1.saved
+
+if dwz 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "\.debug_info section not present" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 0 ]
+
+cmp 1 1.saved
+
+if dwz 1 -o 2 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "\.debug_info section not present" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+[ ! -f 2 ]
+
+rm -f 1 1.saved dwz.err
diff --git a/testsuite/dwz.tests/odr-2.cc b/testsuite/dwz.tests/odr-2.cc
new file mode 100644
index 0000000..8b3dcd2
--- /dev/null
+++ b/testsuite/dwz.tests/odr-2.cc
@@ -0,0 +1,20 @@
+#if NAMESPACE
+namespace ns {
+#endif
+ KIND bbb
+ {
+ int member_four;
+ };
+ KIND ccc;
+#if NAMESPACE
+}
+#endif
+#include "odr.h"
+
+#if NAMESPACE
+KIND ns::aaa var2;
+KIND ns::bbb var4;
+#else
+KIND aaa var2;
+KIND bbb var4;
+#endif
diff --git a/testsuite/dwz.tests/odr-class-ns.sh b/testsuite/dwz.tests/odr-class-ns.sh
new file mode 100644
index 0000000..4b890a3
--- /dev/null
+++ b/testsuite/dwz.tests/odr-class-ns.sh
@@ -0,0 +1,29 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-class-ns 1
+
+verify-dwarf.sh 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 2 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 2 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 2 ]
+
+$execs/dwz-for-test --odr 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 1 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 1 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 1 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr-class.sh b/testsuite/dwz.tests/odr-class.sh
new file mode 100644
index 0000000..872c3ca
--- /dev/null
+++ b/testsuite/dwz.tests/odr-class.sh
@@ -0,0 +1,29 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-class 1
+
+verify-dwarf.sh 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 2 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 2 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 2 ]
+
+$execs/dwz-for-test --odr 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 1 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 1 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 1 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr-def-decl.sh b/testsuite/dwz.tests/odr-def-decl.sh
new file mode 100644
index 0000000..8905e52
--- /dev/null
+++ b/testsuite/dwz.tests/odr-def-decl.sh
@@ -0,0 +1,19 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/def-decl 1
+
+verify-dwarf.sh 1
+
+cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
+[ $cnt -eq 5 ]
+
+$execs/dwz-for-test --odr 1 --devel-ignore-size
+
+verify-dwarf.sh 1
+
+cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
+[ $cnt -eq 2 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr-loc-2.cc b/testsuite/dwz.tests/odr-loc-2.cc
new file mode 100644
index 0000000..7cf832b
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc-2.cc
@@ -0,0 +1,14 @@
+struct bbb
+{
+ int member_four;
+};
+struct ccc;
+
+struct aaa
+{
+ struct bbb *member_one;
+ struct ccc *member_two;
+};
+
+struct aaa var2;
+struct bbb var4;
diff --git a/testsuite/dwz.tests/odr-loc.cc b/testsuite/dwz.tests/odr-loc.cc
new file mode 100644
index 0000000..953fd66
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc.cc
@@ -0,0 +1,19 @@
+struct bbb;
+struct ccc {
+ int member_three;
+};
+
+struct aaa
+{
+ struct bbb *member_one;
+ struct ccc *member_two;
+};
+
+struct aaa var1;
+struct ccc var3;
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/odr-loc.sh b/testsuite/dwz.tests/odr-loc.sh
new file mode 100644
index 0000000..a8b3318
--- /dev/null
+++ b/testsuite/dwz.tests/odr-loc.sh
@@ -0,0 +1,39 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-loc 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 2 ]
+done
+
+$execs/dwz-for-test --odr 1 --devel-ignore-size
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ case $name in
+ aaa)
+ [ $cnt -eq 2 ]
+ ;;
+ *)
+ [ $cnt -eq 1 ]
+ ;;
+ esac
+done
+
+cp $execs/odr-loc 1
+
+$execs/dwz-for-test --odr --devel-ignore-locus 1
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
new file mode 100755
index 0000000..5961abf
--- /dev/null
+++ b/testsuite/dwz.tests/odr-struct-multifile.sh
@@ -0,0 +1,61 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+readelf_flags=""
+if readelf -h 2>&1 | grep -q "\-wN"; then
+ readelf_flags=-wN
+fi
+
+cp $execs/odr-struct 1
+cp 1 2
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 2 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ case $name in
+ member_one|member_two)
+ [ $cnt -eq 2 ]
+ ;;
+ member_three|member_four)
+ [ $cnt -eq 1 ]
+ ;;
+ esac
+done
+
+decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true)
+
+$execs/dwz-for-test --odr 1 2 -m 3
+
+verify-dwarf.sh 1
+verify-dwarf.sh 3
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+# Even with -wN readelf 2.38-15.fc37 follows and prints the contents
+# of the alt file. So make sure it cannot do that by removing it.
+rm 3
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 0 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 0 ]
+done
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/odr-struct-ns.sh b/testsuite/dwz.tests/odr-struct-ns.sh
new file mode 100644
index 0000000..c6e0f1d
--- /dev/null
+++ b/testsuite/dwz.tests/odr-struct-ns.sh
@@ -0,0 +1,49 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-struct-ns 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 2 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ case $name in
+ member_one|member_two)
+ [ $cnt -eq 2 ]
+ ;;
+ member_three|member_four)
+ [ $cnt -eq 1 ]
+ ;;
+ esac
+done
+
+# Check that bbb and ccc are present as DW_AT_declaration
+readelf -wi 1 | grep -3 DW_AT_declaration > decls
+grep bbb decls >/dev/null
+grep ccc decls >/dev/null
+
+$execs/dwz-for-test --odr 1
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+# We expect two decls to be removed, for bbb and ccc.
+readelf -wi 1 | grep -3 DW_AT_declaration > decls || true
+
+if grep bbb decls >/dev/null ; then exit 1; fi
+if grep ccc decls >/dev/null ; then exit 2; fi
+
+rm -f 1 decls
diff --git a/testsuite/dwz.tests/odr-struct.sh b/testsuite/dwz.tests/odr-struct.sh
new file mode 100644
index 0000000..c6793f9
--- /dev/null
+++ b/testsuite/dwz.tests/odr-struct.sh
@@ -0,0 +1,49 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-struct 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 2 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ case $name in
+ member_one|member_two)
+ [ $cnt -eq 2 ]
+ ;;
+ member_three|member_four)
+ [ $cnt -eq 1 ]
+ ;;
+ esac
+done
+
+# Check that bbb and ccc are present as DW_AT_declaration
+readelf -wi 1 | grep -3 DW_AT_declaration > decls
+grep bbb decls >/dev/null
+grep ccc decls >/dev/null
+
+$execs/dwz-for-test --odr 1
+
+verify-dwarf.sh 1
+
+for name in aaa bbb ccc; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+for name in member_one member_two member_three member_four; do
+ cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ [ $cnt -eq 1 ]
+done
+
+# We expect two decls to be removed, for bbb and ccc.
+readelf -wi 1 | grep -3 DW_AT_declaration > decls || true
+
+if grep bbb decls >/dev/null ; then exit 1; fi
+if grep ccc decls >/dev/null ; then exit 2; fi
+
+rm -f 1 decls
diff --git a/testsuite/dwz.tests/odr-union-ns.sh b/testsuite/dwz.tests/odr-union-ns.sh
new file mode 100644
index 0000000..7d86dba
--- /dev/null
+++ b/testsuite/dwz.tests/odr-union-ns.sh
@@ -0,0 +1,29 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-union-ns 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 2 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 2 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 2 ]
+
+$execs/dwz-for-test --odr 1
+
+verify-dwarf.sh 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 1 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 1 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 1 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr-union.sh b/testsuite/dwz.tests/odr-union.sh
new file mode 100644
index 0000000..a32a46c
--- /dev/null
+++ b/testsuite/dwz.tests/odr-union.sh
@@ -0,0 +1,29 @@
+if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
+ exit 77
+fi
+
+cp $execs/odr-union 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 2 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 2 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 2 ]
+
+$execs/dwz-for-test --odr 1
+
+verify-dwarf.sh 1
+
+aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
+[ $aaa -eq 1 ]
+
+bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
+[ $bbb -eq 1 ]
+
+ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
+[ $ccc -eq 1 ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/odr.cc b/testsuite/dwz.tests/odr.cc
new file mode 100644
index 0000000..9505cb3
--- /dev/null
+++ b/testsuite/dwz.tests/odr.cc
@@ -0,0 +1,26 @@
+#if NAMESPACE
+namespace ns {
+#endif
+ KIND bbb;
+ KIND ccc {
+ int member_three;
+ };
+#if NAMESPACE
+}
+#endif
+
+#include "odr.h"
+
+#if NAMESPACE
+KIND ns::aaa var1;
+KIND ns::ccc var3;
+#else
+KIND aaa var1;
+KIND ccc var3;
+#endif
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/odr.h b/testsuite/dwz.tests/odr.h
new file mode 100644
index 0000000..ae0e07d
--- /dev/null
+++ b/testsuite/dwz.tests/odr.h
@@ -0,0 +1,11 @@
+#if NAMESPACE
+namespace ns {
+#endif
+ KIND aaa
+ {
+ KIND bbb *member_one;
+ KIND ccc *member_two;
+ };
+#if NAMESPACE
+}
+#endif
diff --git a/testsuite/dwz.tests/pointer-size.c b/testsuite/dwz.tests/pointer-size.c
new file mode 100644
index 0000000..320633d
--- /dev/null
+++ b/testsuite/dwz.tests/pointer-size.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("%llu\n", (unsigned long long)sizeof (void *));
+ return 0;
+}
diff --git a/testsuite/dwz.tests/pr24170.sh b/testsuite/dwz.tests/pr24170.sh
new file mode 100644
index 0000000..ec57a71
--- /dev/null
+++ b/testsuite/dwz.tests/pr24170.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+exec=$execs/implptr-64bit-d2o4a8r8t0
+
+pointer_sizes=$(readelf -wi $exec \
+ | grep "Pointer Size:" \
+ | sort -u \
+ | wc -l)
+
+if [ $pointer_sizes -ne 1 ]; then
+ exit 77
+fi
+
+cp $exec 1
+cp 1 2
+
+dwz -m 3 1 2
+
+smaller-than.sh 1 $exec
+smaller-than.sh 2 $exec
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/pr24171.sh b/testsuite/dwz.tests/pr24171.sh
new file mode 100644
index 0000000..dd99c05
--- /dev/null
+++ b/testsuite/dwz.tests/pr24171.sh
@@ -0,0 +1,15 @@
+cp $execs/invalid-dw-at-stmt-list-encoding 1
+cp 1 2
+
+if dwz -m 3 1 2 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "DW_AT_stmt_list not DW_FORM_sec_offset or DW_FORM_data4" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+rm -f 1 2 dwz.err
diff --git a/testsuite/dwz.tests/pr24172.sh b/testsuite/dwz.tests/pr24172.sh
new file mode 100644
index 0000000..f455b27
--- /dev/null
+++ b/testsuite/dwz.tests/pr24172.sh
@@ -0,0 +1,14 @@
+cp $execs/dw2-skip-prologue 1
+
+if dwz 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "locexpr length .* exceeds .debug_loc section" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/pr24173.sh b/testsuite/dwz.tests/pr24173.sh
new file mode 100644
index 0000000..908c219
--- /dev/null
+++ b/testsuite/dwz.tests/pr24173.sh
@@ -0,0 +1,16 @@
+cp $execs/py-section-script 1
+
+eu-strip -g -f 1.debug 1
+
+if dwz 1.debug 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "Found empty .debug_gdb_scripts section, not attempting dwz compression" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+rm -f 1 1.debug dwz.err
diff --git a/testsuite/dwz.tests/pr24174.sh b/testsuite/dwz.tests/pr24174.sh
new file mode 100644
index 0000000..8d1192c
--- /dev/null
+++ b/testsuite/dwz.tests/pr24174.sh
@@ -0,0 +1,24 @@
+exec=$execs/hello
+cp $exec 1
+objcopy --compress-debug-sections 1
+if readelf -S 1 \
+ | grep -A1 '\.debug_' \
+ | grep -v '\.debug_' \
+ | grep -q 'C'; then
+ true
+else
+ exit 77
+fi
+
+if dwz 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if grep -q "DWARF version 0 unhandled" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/pr24341.sh b/testsuite/dwz.tests/pr24341.sh
new file mode 100644
index 0000000..4f044f6
--- /dev/null
+++ b/testsuite/dwz.tests/pr24341.sh
@@ -0,0 +1,17 @@
+cp $execs/min 1
+cp 1 2
+
+dwz -m 3 1 2
+
+cnt=$(readelf -S 3 | grep "\.debug_info" | wc -l)
+if [ $cnt -ne 0 ]; then
+ exit 77
+fi
+
+smaller-than.sh 1 $execs/min
+smaller-than.sh 2 $execs/min
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh
new file mode 100644
index 0000000..7990e83
--- /dev/null
+++ b/testsuite/dwz.tests/pr24468.sh
@@ -0,0 +1,19 @@
+exec=$execs/testsuite/dwz.tests/execs/hello-leap-15.0
+
+cp $exec 1
+cp 1 2
+
+dwz -m 3 1 2
+
+readelf -wi 1 > READELF 2>/dev/null
+
+offsets=$(grep '(DW_TAG_partial_unit' READELF \
+ | grep -v "DW_AT_import" \
+ | awk '{print $1}' \
+ | sed 's/.*<//;s/>.*//')
+for off in $offsets; do
+ imports=$(grep -c "DW_AT_import.*0x$off" READELF || true)
+ [ $imports -gt 0 ]
+done
+
+rm -f 1 2 3 READELF
diff --git a/testsuite/dwz.tests/pr24542.sh b/testsuite/dwz.tests/pr24542.sh
new file mode 100644
index 0000000..f797034
--- /dev/null
+++ b/testsuite/dwz.tests/pr24542.sh
@@ -0,0 +1,15 @@
+cp $execs/start 1
+cp 1 2
+
+if dwz -m 3 1 2 2> dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "No suitable DWARF found for multifile optimization" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 0 ]
+
+rm -f 1 2 3 dwz.err
diff --git a/testsuite/dwz.tests/pr24747.sh b/testsuite/dwz.tests/pr24747.sh
new file mode 100644
index 0000000..7182f72
--- /dev/null
+++ b/testsuite/dwz.tests/pr24747.sh
@@ -0,0 +1,7 @@
+exec=$execs/start-gold
+
+cp $exec 1
+
+dwz 1
+
+rm -f 1
diff --git a/testsuite/dwz.tests/pr24771.sh b/testsuite/dwz.tests/pr24771.sh
new file mode 100644
index 0000000..4eb6c02
--- /dev/null
+++ b/testsuite/dwz.tests/pr24771.sh
@@ -0,0 +1,9 @@
+exec=$execs/hello-gnu-pubnames
+
+cp $exec 1
+
+dwz 1
+
+smaller-than.sh 1 $exec
+
+rm -f 1
diff --git a/testsuite/dwz.tests/pr24823.sh b/testsuite/dwz.tests/pr24823.sh
new file mode 100644
index 0000000..8720aec
--- /dev/null
+++ b/testsuite/dwz.tests/pr24823.sh
@@ -0,0 +1,25 @@
+exec=$execs/varval
+
+pointer_sizes=$(readelf -wi $exec \
+ | grep "Pointer Size:" \
+ | sort -u \
+ | wc -l)
+
+if [ $pointer_sizes -ne 1 ]; then
+ exit 77
+fi
+
+cp $exec 1
+cp 1 2
+
+dwz -m 3 1 2
+
+if [ -f 3 ]; then
+ readelf -wi 3 > READELF.3
+ if grep -q var_c READELF.3; status=$?; then
+ true
+ fi
+ [ $status -ne 0 ]
+fi
+
+rm -f 1 2 3 READELF.3
diff --git a/testsuite/dwz.tests/pr25109.sh b/testsuite/dwz.tests/pr25109.sh
new file mode 100644
index 0000000..6da1f22
--- /dev/null
+++ b/testsuite/dwz.tests/pr25109.sh
@@ -0,0 +1,6 @@
+cp $execs/no-multifile-prop 1
+cp 1 2
+
+$execs/dwz-for-test -m 3 1 2 --devel-ignore-size
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/pr27463.sh b/testsuite/dwz.tests/pr27463.sh
new file mode 100644
index 0000000..cd0238c
--- /dev/null
+++ b/testsuite/dwz.tests/pr27463.sh
@@ -0,0 +1,6 @@
+cp $execs/unavailable-dwarf-piece 1
+cp 1 2
+
+dwz -m 3 1 2
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/py-section-script.s b/testsuite/dwz.tests/py-section-script.s
new file mode 100644
index 0000000..1f5efc7
--- /dev/null
+++ b/testsuite/dwz.tests/py-section-script.s
@@ -0,0 +1,393 @@
+# Generated using gdb/testsuite/gdb.python/py-section-script.c from repo
+# git://sourceware.org/git/binutils-gdb.git.
+
+ .file "py-section-script.c"
+ .text
+.Ltext0:
+#APP
+ .pushsection ".debug_gdb_scripts", "S",%progbits
+.byte 1
+.asciz "py-section-script.py"
+.popsection
+
+ .pushsection ".debug_gdb_scripts", "S",%progbits
+.byte 1
+.asciz "py-section-script.py"
+.popsection
+
+ .pushsection ".debug_gdb_scripts", "S",%progbits
+.byte 4
+.ascii "gdb.inlined-script\n"
+.ascii "class test_cmd (gdb.Command):\n"
+.ascii " def __init__ (self):\n"
+.ascii " super (test_cmd, self).__init__ (\"test-cmd\", gdb.COMMAND_OBSCURE)\n"
+.ascii " def invoke (self, arg, from_tty):\n"
+.ascii " print (\"test-cmd output, arg = %s\" % arg)\n"
+.ascii "test_cmd ()\n"
+.byte 0
+.popsection
+
+ .pushsection ".debug_gdb_scripts", "S",%progbits
+.byte 4
+.ascii "gdb.inlined-script\n"
+.ascii "class test_cmd (gdb.Command):\n"
+.ascii " def __init__ (self):\n"
+.ascii " super (test_cmd, self).__init__ (\"test-cmd\", gdb.COMMAND_OBSCURE)\n"
+.ascii " def invoke (self, arg, from_tty):\n"
+.ascii " print (\"test-cmd output, arg = %s\" % arg)\n"
+.ascii "test_cmd ()\n"
+.byte 0
+.popsection
+
+#NO_APP
+ .globl init_ss
+ .type init_ss, @function
+init_ss:
+.LFB0:
+ .file 1 "py-section-script.c"
+ # py-section-script.c:76
+ .loc 1 76 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ movq %rdi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %edx, -16(%rbp)
+ # py-section-script.c:77
+ .loc 1 77 0
+ movq -8(%rbp), %rax
+ movl -12(%rbp), %edx
+ movl %edx, (%rax)
+ # py-section-script.c:78
+ .loc 1 78 0
+ movq -8(%rbp), %rax
+ movl -16(%rbp), %edx
+ movl %edx, 4(%rax)
+ # py-section-script.c:79
+ .loc 1 79 0
+ nop
+ popq %rbp
+ .cfi_def_cfa 7, 8
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE0:
+ .size init_ss, .-init_ss
+ .globl main
+ .type main, @function
+main:
+.LFB1:
+ # py-section-script.c:83
+ .loc 1 83 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ subq $16, %rsp
+ # py-section-script.c:86
+ .loc 1 86 0
+ leaq -8(%rbp), %rax
+ movl $2, %edx
+ movl $1, %esi
+ movq %rax, %rdi
+ call init_ss
+ # py-section-script.c:88
+ .loc 1 88 0
+ movl $0, %eax
+ # py-section-script.c:89
+ .loc 1 89 0
+ leave
+ .cfi_def_cfa 7, 8
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 0xc8 # Length of Compilation Unit Info
+ .value 0x4 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x8 # Pointer Size (in bytes)
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF2 # DW_AT_producer: "GNU C11 7.3.1 20180323 [gcc-7-branch revision 258812] -mtune=generic -march=x86-64 -g"
+ .byte 0xc # DW_AT_language
+ .long .LASF3 # DW_AT_name: "py-section-script.c"
+ .long .LASF4 # DW_AT_comp_dir: "/home/vries/gdb_versions/devel"
+ .quad .Ltext0 # DW_AT_low_pc
+ .quad .Letext0-.Ltext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_structure_type)
+ .ascii "ss\0" # DW_AT_name
+ .byte 0x8 # DW_AT_byte_size
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x44 # DW_AT_decl_line
+ .long 0x4d # DW_AT_sibling
+ .uleb128 0x3 # (DIE (0x38) DW_TAG_member)
+ .ascii "a\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x46 # DW_AT_decl_line
+ .long 0x4d # DW_AT_type
+ .byte 0 # DW_AT_data_member_location
+ .uleb128 0x3 # (DIE (0x42) DW_TAG_member)
+ .ascii "b\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x47 # DW_AT_decl_line
+ .long 0x4d # DW_AT_type
+ .byte 0x4 # DW_AT_data_member_location
+ .byte 0 # end of children of DIE 0x2d
+ .uleb128 0x4 # (DIE (0x4d) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .ascii "int\0" # DW_AT_name
+ .uleb128 0x5 # (DIE (0x54) DW_TAG_subprogram)
+ # DW_AT_external
+ .long .LASF0 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x52 # DW_AT_decl_line
+ .long 0x4d # DW_AT_type
+ .quad .LFB1 # DW_AT_low_pc
+ .quad .LFE1-.LFB1 # DW_AT_high_pc
+ .uleb128 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ # DW_AT_GNU_all_tail_call_sites
+ .long 0x83 # DW_AT_sibling
+ .uleb128 0x6 # (DIE (0x75) DW_TAG_variable)
+ .ascii "ss\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x54 # DW_AT_decl_line
+ .long 0x2d # DW_AT_type
+ .uleb128 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -24
+ .byte 0 # end of children of DIE 0x54
+ .uleb128 0x7 # (DIE (0x83) DW_TAG_subprogram)
+ # DW_AT_external
+ .long .LASF1 # DW_AT_name: "init_ss"
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x4b # DW_AT_decl_line
+ # DW_AT_prototyped
+ .quad .LFB0 # DW_AT_low_pc
+ .quad .LFE0-.LFB0 # DW_AT_high_pc
+ .uleb128 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ # DW_AT_GNU_all_call_sites
+ .long 0xc5 # DW_AT_sibling
+ .uleb128 0x8 # (DIE (0xa0) DW_TAG_formal_parameter)
+ .ascii "s\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x4b # DW_AT_decl_line
+ .long 0xc5 # DW_AT_type
+ .uleb128 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -24
+ .uleb128 0x8 # (DIE (0xac) DW_TAG_formal_parameter)
+ .ascii "a\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x4b # DW_AT_decl_line
+ .long 0x4d # DW_AT_type
+ .uleb128 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -28
+ .uleb128 0x8 # (DIE (0xb8) DW_TAG_formal_parameter)
+ .ascii "b\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (py-section-script.c)
+ .byte 0x4b # DW_AT_decl_line
+ .long 0x4d # DW_AT_type
+ .uleb128 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -32
+ .byte 0 # end of children of DIE 0x83
+ .uleb128 0x9 # (DIE (0xc5) DW_TAG_pointer_type)
+ .byte 0x8 # DW_AT_byte_size
+ .long 0x2d # DW_AT_type
+ .byte 0 # end of children of DIE 0xb
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x17 # (DW_FORM_sec_offset)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x13 # (TAG: DW_TAG_structure_type)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0xd # (TAG: DW_TAG_member)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x38 # (DW_AT_data_member_location)
+ .uleb128 0xb # (DW_FORM_data1)
+ .byte 0
+ .byte 0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .byte 0
+ .byte 0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .byte 0
+ .byte 0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .byte 0
+ .byte 0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0xf # (TAG: DW_TAG_pointer_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x8 # Size of Address
+ .byte 0 # Size of Segment Descriptor
+ .value 0 # Pad to 16 byte boundary
+ .value 0
+ .quad .Ltext0 # Address
+ .quad .Letext0-.Ltext0 # Length
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF2:
+ .string "GNU C11 7.3.1 20180323 [gcc-7-branch revision 258812] -mtune=generic -march=x86-64 -g"
+.LASF3:
+ .string "py-section-script.c"
+.LASF0:
+ .string "main"
+.LASF4:
+ .string "/home/vries/gdb_versions/devel"
+.LASF1:
+ .string "init_ss"
+ .ident "GCC: (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]"
+ .section .note.GNU-stack,"",@progbits
diff --git a/testsuite/dwz.tests/regular-o.sh b/testsuite/dwz.tests/regular-o.sh
new file mode 100644
index 0000000..1416e90
--- /dev/null
+++ b/testsuite/dwz.tests/regular-o.sh
@@ -0,0 +1,9 @@
+cp $execs/hello 1
+
+dwz 1 -o 2
+
+cmp 1 $execs/hello
+
+smaller-than.sh 2 1
+
+rm -f 1 2
diff --git a/testsuite/dwz.tests/regular.sh b/testsuite/dwz.tests/regular.sh
new file mode 100644
index 0000000..9d33153
--- /dev/null
+++ b/testsuite/dwz.tests/regular.sh
@@ -0,0 +1,7 @@
+cp $execs/hello 1
+
+dwz 1
+
+smaller-than.sh 1 $execs/hello
+
+rm -f 1
diff --git a/testsuite/dwz.tests/save-temps.sh b/testsuite/dwz.tests/save-temps.sh
new file mode 100644
index 0000000..bcc1f1b
--- /dev/null
+++ b/testsuite/dwz.tests/save-temps.sh
@@ -0,0 +1,20 @@
+cp $execs/hello 1
+cp $execs/hello 2
+
+$execs/dwz-for-test --devel-save-temps -m 3 1 2
+
+files="
+ dwz.debug_abbrev
+ dwz.debug_info
+ dwz.debug_line
+ dwz.debug_macro
+ dwz.debug_str
+ dwz.1
+ dwz.2
+"
+
+for f in $files; do
+ [ -f $f ]
+done
+
+rm -f 1 2 3 $files
diff --git a/testsuite/dwz.tests/start.c b/testsuite/dwz.tests/start.c
new file mode 100644
index 0000000..a925613
--- /dev/null
+++ b/testsuite/dwz.tests/start.c
@@ -0,0 +1,3 @@
+void _start (void)
+{
+}
diff --git a/testsuite/dwz.tests/too-many-dies.sh b/testsuite/dwz.tests/too-many-dies.sh
new file mode 100644
index 0000000..53a0f4b
--- /dev/null
+++ b/testsuite/dwz.tests/too-many-dies.sh
@@ -0,0 +1,16 @@
+cp $execs/hello 1
+
+if dwz -L0 1 2>dwz.err; status=?; then
+ true
+fi
+
+if ! grep -q "Too many DIEs, not optimizing" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+cmp 1 $execs/hello
+
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/twice-hardlink.sh b/testsuite/dwz.tests/twice-hardlink.sh
new file mode 100644
index 0000000..6bc0794
--- /dev/null
+++ b/testsuite/dwz.tests/twice-hardlink.sh
@@ -0,0 +1,31 @@
+cp $execs/hello 1
+ln 1 2
+
+dwz -h 1 2
+
+smaller-than.sh 1 $execs/hello
+
+hardlinks-p.sh 1 2
+
+cp 1 1.saved
+
+if dwz -h 1 2 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "DWARF compression not beneficial" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+if [ $(grep -qv "DWARF compression not beneficial" dwz.err \
+ | wc -l) -gt 0 ]; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 0 ]
+
+cmp 1 1.saved
+
+rm -f 1 1.saved 2 2.saved dwz.err
diff --git a/testsuite/dwz.tests/twice-multifile.sh b/testsuite/dwz.tests/twice-multifile.sh
new file mode 100644
index 0000000..1ff0166
--- /dev/null
+++ b/testsuite/dwz.tests/twice-multifile.sh
@@ -0,0 +1,34 @@
+cp $execs/hello 1
+cp 1 2
+
+dwz 1 2
+
+smaller-than.sh 1 $execs/hello
+smaller-than.sh 2 $execs/hello
+
+cp 1 1.saved
+cp 2 2.saved
+
+if dwz -m 3 1 2 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "DWARF compression not beneficial" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+if [ $(grep -qv "DWARF compression not beneficial" dwz.err \
+ | wc -l) -gt 0 ]; then
+ cat dwz.err
+ exit 1
+fi
+
+if [ $status -ne 0 ]; then
+ cat dwz.err
+ exit 1
+fi
+
+smaller-than.sh 1 1.saved
+
+rm -f 1 1.saved 2 2.saved dwz.err 3
diff --git a/testsuite/dwz.tests/twice.sh b/testsuite/dwz.tests/twice.sh
new file mode 100644
index 0000000..210a966
--- /dev/null
+++ b/testsuite/dwz.tests/twice.sh
@@ -0,0 +1,28 @@
+cp $execs/hello 1
+
+dwz 1
+
+smaller-than.sh 1 $execs/hello
+
+cp 1 1.saved
+
+if dwz 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "DWARF compression not beneficial" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+if [ $(grep -qv "DWARF compression not beneficial" dwz.err \
+ | wc -l) -gt 0 ]; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 0 ]
+
+cmp 1 1.saved
+
+rm -f 1 1.saved dwz.err
diff --git a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
new file mode 100644
index 0000000..ee31359
--- /dev/null
+++ b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
@@ -0,0 +1,15 @@
+cp $execs/hello 1
+cp 1 2
+
+$execs/dwz-for-test \
+ -l0 \
+ --devel-trace \
+ 1 2 \
+ -j 1 \
+ 2> dwz.err
+
+if grep -Eq "Compressing (1|2)$" dwz.err; then
+ exit 1
+fi
+
+rm -f 1 2 dwz.err
diff --git a/testsuite/dwz.tests/two-files-too-many-dies-2.sh b/testsuite/dwz.tests/two-files-too-many-dies-2.sh
new file mode 100644
index 0000000..91b5ccc
--- /dev/null
+++ b/testsuite/dwz.tests/two-files-too-many-dies-2.sh
@@ -0,0 +1,22 @@
+cp $execs/hello 1
+cp $execs/dwz-for-test 2
+
+limit=$(readelf -wi 2 \
+ | grep '(DW_TAG' \
+ | wc -l)
+limit=$((limit - 1))
+
+if dwz -L$limit 2 1 2>dwz.err; status=$?; then
+ true
+fi
+
+if [ $status -eq 0 ]; then
+ echo "PR24301 workaround used" > dwz.info
+else
+ [ $status -eq 1 ]
+fi
+
+smaller-than.sh 1 $execs/hello
+cmp 2 $execs/dwz-for-test
+
+rm -f 1 2 dwz.err
diff --git a/testsuite/dwz.tests/two-files-too-many-dies.sh b/testsuite/dwz.tests/two-files-too-many-dies.sh
new file mode 100644
index 0000000..13950ba
--- /dev/null
+++ b/testsuite/dwz.tests/two-files-too-many-dies.sh
@@ -0,0 +1,17 @@
+cp $execs/hello 1
+cp 1 2
+if dwz -L0 1 2 2>dwz.err; status=$?; then
+ true
+fi
+
+if ! grep -q "Too many DIEs, not optimizing" dwz.err; then
+ cat dwz.err
+ exit 1
+fi
+
+[ $status -eq 1 ]
+
+cmp 1 $execs/hello
+cmp 2 $execs/hello
+
+rm -f 1 2 dwz.err
diff --git a/testsuite/dwz.tests/two-typedef-2.c b/testsuite/dwz.tests/two-typedef-2.c
new file mode 100644
index 0000000..8af8df6
--- /dev/null
+++ b/testsuite/dwz.tests/two-typedef-2.c
@@ -0,0 +1,6 @@
+
+typedef long unsigned int size_t;
+
+#include "two-typedef.h"
+
+struct aaa var2;
diff --git a/testsuite/dwz.tests/two-typedef.c b/testsuite/dwz.tests/two-typedef.c
new file mode 100644
index 0000000..fb1e044
--- /dev/null
+++ b/testsuite/dwz.tests/two-typedef.c
@@ -0,0 +1,11 @@
+typedef long unsigned int size_t;
+
+#include "two-typedef.h"
+
+struct aaa var;
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/testsuite/dwz.tests/two-typedef.h b/testsuite/dwz.tests/two-typedef.h
new file mode 100644
index 0000000..1675f39
--- /dev/null
+++ b/testsuite/dwz.tests/two-typedef.h
@@ -0,0 +1,3 @@
+struct aaa {
+ size_t size;
+};
diff --git a/testsuite/dwz.tests/varval.S b/testsuite/dwz.tests/varval.S
new file mode 100644
index 0000000..09f65d9
--- /dev/null
+++ b/testsuite/dwz.tests/varval.S
@@ -0,0 +1,515 @@
+# Generated using gdb/testsuite/gdb.dwarf2/varval.exp from repo
+# git://sourceware.org/git/binutils-gdb.git.
+ .section .debug_info
+.Lcu1_begin:
+ .4byte .Lcu1_end - .Lcu1_start
+.Lcu1_start:
+ .2byte 4 /* Version */
+ .4byte .Labbrev1_begin /* Abbrevs */
+ .byte 8 /* Pointer size */
+ .uleb128 2 /* Abbrev (DW_TAG_compile_unit) */
+ .sleb128 0x0004
+.Llabel1:
+ .uleb128 3 /* Abbrev (DW_TAG_base_type) */
+ .uleb128 4
+ .sleb128 0x5
+ .ascii "int\0"
+.Llabel2:
+ .uleb128 4 /* Abbrev (DW_TAG_pointer_type) */
+ .4byte .Llabel1 - .Lcu1_begin
+.Llabel4:
+ .uleb128 5 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_a\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+ .uleb128 .Lexpr_end16 - .Lexpr_start15/* expression */
+.Lexpr_start15:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_a
+.Lexpr_end16:
+.Llabel12:
+ .uleb128 6 /* Abbrev (DW_TAG_variable) */
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+.Llabel5:
+ .uleb128 7 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_b\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+ .uleb128 .Lexpr_end18 - .Lexpr_start17/* expression */
+.Lexpr_start17:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_b
+.Lexpr_end18:
+.Llabel6:
+ .uleb128 8 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_c\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+ .sleb128 53
+.Llabel7:
+ .uleb128 9 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_p\0"
+ .4byte .Llabel2 - .Lcu1_begin
+ .byte 1
+ .uleb128 .Lexpr_end20 - .Lexpr_start19/* expression */
+.Lexpr_start19:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_p
+.Lexpr_end20:
+.Llabel3:
+ .uleb128 10 /* Abbrev (DW_TAG_structure_type) */
+ .sleb128 8*4
+ .uleb128 11 /* Abbrev (DW_TAG_member) */
+ .ascii "a\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 0*4
+ .uleb128 12 /* Abbrev (DW_TAG_member) */
+ .ascii "b\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 1*4
+ .uleb128 13 /* Abbrev (DW_TAG_member) */
+ .ascii "c\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 2*4
+ .uleb128 14 /* Abbrev (DW_TAG_member) */
+ .ascii "d\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 3*4
+ .uleb128 15 /* Abbrev (DW_TAG_member) */
+ .ascii "e\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 4*4
+ .uleb128 16 /* Abbrev (DW_TAG_member) */
+ .ascii "f\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 5*4
+ .uleb128 17 /* Abbrev (DW_TAG_member) */
+ .ascii "g\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 6*4
+ .uleb128 18 /* Abbrev (DW_TAG_member) */
+ .ascii "h\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 7*4
+ .byte 0x0 /* Terminate children */
+.Llabel10:
+ .uleb128 19 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_s\0"
+ .4byte .Llabel3 - .Lcu1_begin
+ .byte 1
+ .uleb128 .Lexpr_end22 - .Lexpr_start21/* expression */
+.Lexpr_start21:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_s
+.Lexpr_end22:
+.Llabel11:
+ .uleb128 20 /* Abbrev (DW_TAG_variable) */
+ .ascii "var_untyped\0"
+ .byte 1
+ .uleb128 .Lexpr_end24 - .Lexpr_start23/* expression */
+.Lexpr_start23:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_b
+.Lexpr_end24:
+ .uleb128 21 /* Abbrev (DW_TAG_subprogram) */
+ .ascii "main\0"
+ .8byte main_label - 4
+ .8byte main_label - 4 + 11
+ .4byte .Llabel1 - .Lcu1_begin
+ .byte 1
+.Llabel9:
+ .uleb128 22 /* Abbrev (DW_TAG_variable) */
+ .ascii "varval\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 .Lexpr_end26 - .Lexpr_start25/* expression */
+.Lexpr_start25:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel4
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end26:
+.Llabel14:
+ .uleb128 23 /* Abbrev (DW_TAG_variable) */
+ .ascii "varval2\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 .Lexpr_end28 - .Lexpr_start27/* expression */
+.Lexpr_start27:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel12
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end28:
+.Llabel13:
+ .uleb128 24 /* Abbrev (DW_TAG_variable) */
+ .4byte .Llabel12 - .Lcu1_begin
+ .uleb128 .Lexpr_end30 - .Lexpr_start29/* expression */
+.Lexpr_start29:
+ .byte 0x03 /* DW_OP_addr */
+ .8byte var_a
+.Lexpr_end30:
+ .uleb128 25 /* Abbrev (DW_TAG_variable) */
+ .ascii "constval\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 .Lexpr_end32 - .Lexpr_start31/* expression */
+.Lexpr_start31:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel6
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end32:
+ .uleb128 26 /* Abbrev (DW_TAG_variable) */
+ .ascii "mixedval\0"
+ .4byte .Llabel1 - .Lcu1_begin
+ .uleb128 .Lexpr_end34 - .Lexpr_start33/* expression */
+.Lexpr_start33:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel6
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel5
+ .byte 0x1b /* DW_OP_div */
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel9
+ .byte 0x22 /* DW_OP_plus */
+ .byte 0x12 /* DW_OP_dup */
+ .byte 0x22 /* DW_OP_plus */
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel9
+ .byte 0x1c /* DW_OP_minus */
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end34:
+ .uleb128 27 /* Abbrev (DW_TAG_variable) */
+ .ascii "pointerval\0"
+ .4byte .Llabel2 - .Lcu1_begin
+ .uleb128 .Lexpr_end36 - .Lexpr_start35/* expression */
+.Lexpr_start35:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel7
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end36:
+ .uleb128 28 /* Abbrev (DW_TAG_variable) */
+ .ascii "structval\0"
+ .4byte .Llabel3 - .Lcu1_begin
+ .uleb128 .Lexpr_end38 - .Lexpr_start37/* expression */
+.Lexpr_start37:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel10
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end38:
+ .uleb128 29 /* Abbrev (DW_TAG_variable) */
+ .ascii "untypedval\0"
+ .uleb128 .Lexpr_end40 - .Lexpr_start39/* expression */
+.Lexpr_start39:
+ .byte 0xfd /* DW_OP_GNU_variable_value */
+ .4byte .Llabel11
+ .byte 0x9f /* DW_OP_stack_value */
+.Lexpr_end40:
+ .byte 0x0 /* Terminate children */
+ .byte 0x0 /* Terminate children */
+.Lcu1_end:
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 2 /* Abbrev start */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 3 /* Abbrev start */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 4 /* Abbrev start */
+ .uleb128 0x0f /* DW_TAG_pointer_type */
+ .byte 0 /* has_children */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 5 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 6 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 7 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 8 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x1c /* DW_AT_const_value */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 9 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 10 /* Abbrev start */
+ .uleb128 0x13 /* DW_TAG_structure_type */
+ .byte 1 /* has_children */
+ .uleb128 0x0b /* DW_AT_byte_size */
+ .uleb128 0x0d /* DW_FORM_sdata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 11 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 12 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 13 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 14 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 15 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 16 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 17 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 18 /* Abbrev start */
+ .uleb128 0x0d /* DW_TAG_member */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x38 /* DW_AT_data_member_location */
+ .uleb128 0x0f /* DW_FORM_udata */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 19 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 20 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 21 /* Abbrev start */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x01 /* DW_FORM_addr */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 22 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 23 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 24 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x31 /* DW_AT_abstract_origin */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 25 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 26 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 27 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 28 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .uleb128 29 /* Abbrev start */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x03 /* DW_AT_name */
+ .uleb128 0x08 /* DW_FORM_string */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0x18 /* DW_FORM_exprloc */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+ .section .note.GNU-stack,"",@progbits
diff --git a/testsuite/dwz.tests/varval.c b/testsuite/dwz.tests/varval.c
new file mode 100644
index 0000000..f76bfa8
--- /dev/null
+++ b/testsuite/dwz.tests/varval.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2018-2019 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ 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/>.
+
+ This was copied from the git://sourceware.org/git/binutils-gdb.git
+ repository, file gdb/testsuite/gdb.dwarf2/varval.c. */
+
+/* Test program for DW_OP_GNU_variable_value. */
+
+int var_a = 8;
+int var_b = 3;
+int *var_p = &var_b;
+struct { int a, b, c, d, e, f, g, h; } var_s = { 101, 102, 103, 104, 105, 106, 107, 108 };
+
+int
+main (void)
+{
+ asm ("main_label: .globl main_label");
+ return 0;
+}
diff --git a/testsuite/dwz.tests/version.sh b/testsuite/dwz.tests/version.sh
new file mode 100644
index 0000000..fb000c7
--- /dev/null
+++ b/testsuite/dwz.tests/version.sh
@@ -0,0 +1,9 @@
+cp $execs/hello 1
+
+dwz -v 1 > dwz.out 2> /dev/null
+
+grep -q "dwz version" dwz.out
+
+cmp 1 $execs/hello
+
+rm -f 1 dwz.out