aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-05-15 11:21:38 +0100
committerNick Clifton <nickc@redhat.com>2015-05-15 11:24:33 +0100
commitd1c4b12b9d48d9266b78e2c22d70aa25830b9f8f (patch)
tree3f096548d3838f9387b3b8b7175a6a231f335c76 /binutils/testsuite
parent4bc0608a8b693f033555aa5705fdd5fc44cb9a9a (diff)
downloadgdb-d1c4b12b9d48d9266b78e2c22d70aa25830b9f8f.zip
gdb-d1c4b12b9d48d9266b78e2c22d70aa25830b9f8f.tar.gz
gdb-d1c4b12b9d48d9266b78e2c22d70aa25830b9f8f.tar.bz2
Fix PR18374 by making readelf and objdump ignore end-of-list markers in the .debug_loc section if there are relocations against them.
PR binutils/18374 bin * dwarf.h (struct dwarf_section): Add reloc_info and num_relocs fields. (struct dwarf_section_display): Change bitfield to boolean. (reloc_at): Add prototype. * dwarf.c (display_loc_list): Ignore list terminators if there are relocs against them. (display_debug_loc): Issue a warning if there are relocs against the .debug_loc section. (display_displays): Initialise reloc_info and num_relocs fields. * objdump.c (load_specific_debug_section): Initialise reloc_info and num_relocs fields. (reloc_at): New function. * readelf.c (is_32bit_abs_reloc): Add IA64's R_IA64_DIS32LSB reloc. (reloc_at): New function. (apply_relocations): Add relocs_return and num_relocs_return parameters. Fill them in with the loaded relocs if non-NULL. (dump_section_as_bytes): Update call to apply_relocations. (load_specific_debug_section): Initialise reloc_info and num_relocs fields. tests * binutils-all/pr18374.s: New test file. * binutils-all/readelf.exp: Assemble and run the new test. * binutils-all/readelf.pr18374: Expected output from readelf.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/pr18374.s234
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp16
-rw-r--r--binutils/testsuite/binutils-all/readelf.pr1837414
4 files changed, 271 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 8b1e3b4..ad8d8ad 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -4,6 +4,13 @@
with "$OBJDUMP -W".
* binutils-all/libdw2-compressedgabi.out: Updated.
+2015-05-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/18374
+ * binutils-all/pr18374.s: New test file.
+ * binutils-all/readelf.exp: Assemble and run the new test.
+ * binutils-all/readelf.pr18374: Expected output from readelf.
+
2015-05-12 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/elfedit-1.d: Also skip x86_64-*-nacl*.
diff --git a/binutils/testsuite/binutils-all/pr18374.s b/binutils/testsuite/binutils-all/pr18374.s
new file mode 100644
index 0000000..793fb70
--- /dev/null
+++ b/binutils/testsuite/binutils-all/pr18374.s
@@ -0,0 +1,234 @@
+ .section .debug_info,"",%progbits
+ .4byte 0x77
+ .2byte 0x4
+ .4byte .Ldebug_abbrev0
+ .byte 0x4
+ .uleb128 0x1
+ .4byte .LASF3
+ .byte 0xc
+ .ascii "x.c\000"
+ .4byte .LASF4
+ .4byte .Ltext0
+ .4byte .Letext0
+ .4byte .Ldebug_line0
+ .uleb128 0x2
+ .ascii "foo\000"
+ .byte 0x1
+ .byte 0x2
+ .4byte .LFB0
+ .4byte .LFE0
+ .uleb128 0x1
+ .byte 0x9c
+ .4byte 0x64
+ .uleb128 0x3
+ .ascii "b\000"
+ .byte 0x1
+ .byte 0x2
+ .4byte 0x64
+ .4byte .LLST0
+ .uleb128 0x4
+ .4byte .LASF0
+ .byte 0x1
+ .byte 0x2
+ .4byte 0x66
+ .4byte .LLST1
+ .uleb128 0x5
+ .ascii "ptr\000"
+ .byte 0x1
+ .byte 0x4
+ .4byte 0x6d
+ .uleb128 0x1
+ .byte 0x50
+ .byte 0
+ .uleb128 0x6
+ .byte 0x4
+ .uleb128 0x7
+ .byte 0x4
+ .byte 0x7
+ .4byte .LASF1
+ .uleb128 0x8
+ .byte 0x4
+ .4byte 0x73
+ .uleb128 0x7
+ .byte 0x1
+ .byte 0x8
+ .4byte .LASF2
+ .byte 0
+
+ .section .debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x1b
+ .uleb128 0xe
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x6
+ .uleb128 0x10
+ .uleb128 0x17
+ .byte 0
+ .byte 0
+ .uleb128 0x2
+ .uleb128 0x2e
+ .byte 0x1
+ .uleb128 0x3f
+ .uleb128 0x19
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x27
+ .uleb128 0x19
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x6
+ .uleb128 0x40
+ .uleb128 0x18
+ .uleb128 0x2117
+ .uleb128 0x19
+ .uleb128 0x1
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x5
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0x17
+ .byte 0
+ .byte 0
+ .uleb128 0x4
+ .uleb128 0x5
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0x17
+ .byte 0
+ .byte 0
+ .uleb128 0x5
+ .uleb128 0x34
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0x18
+ .byte 0
+ .byte 0
+ .uleb128 0x6
+ .uleb128 0xf
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .byte 0
+ .byte 0
+ .uleb128 0x7
+ .uleb128 0x24
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .byte 0
+ .byte 0
+ .uleb128 0x8
+ .uleb128 0xf
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0
+ .byte 0
+ .byte 0
+
+ .section .debug_loc,"",%progbits
+.Ldebug_loc0:
+.LLST0:
+ .4byte .LVL0
+ .4byte .LVL2
+ .2byte 0x1
+ .byte 0x50
+ .4byte .LVL2
+ .4byte .LFE0
+ .2byte 0x4
+ .byte 0xf3
+ .uleb128 0x1
+ .byte 0x50
+ .byte 0x9f
+ .4byte 0
+ .4byte 0
+.LLST1:
+ .4byte .LVL0
+ .4byte .LVL1
+ .2byte 0x1
+ .byte 0x51
+ .4byte .LVL1
+ .4byte .LVL2
+ .2byte 0x3
+ .byte 0x71
+ .sleb128 -1
+ .byte 0x9f
+ .4byte .LVL2
+ .4byte .LVL3
+ .2byte 0xb
+ .byte 0x70
+ .sleb128 0
+ .byte 0x20
+ .byte 0xf3
+ .uleb128 0x1
+ .byte 0x51
+ .byte 0x22
+ .byte 0x70
+ .sleb128 0
+ .byte 0x22
+ .byte 0x9f
+ .4byte .LVL3
+ .4byte .LFE0
+ .2byte 0xb
+ .byte 0x70
+ .sleb128 0
+ .byte 0x20
+ .byte 0x70
+ .sleb128 0
+ .byte 0x22
+ .byte 0xf3
+ .uleb128 0x1
+ .byte 0x51
+ .byte 0x22
+ .byte 0x9f
+ .4byte 0
+ .4byte 0
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 3c6472b..58e140c 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -356,3 +356,19 @@ if ![is_remote host] {
}
readelf_test -n $tempfile readelf.n {}
+
+# PR 18374 - Check that relocations against the .debug_loc section
+# do not prevent readelf from displaying all the location lists.
+if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then {
+ perror "could not assemble PR18374 test file"
+ unresolved "readelf - failed to assemble"
+ return
+}
+
+if ![is_remote host] {
+ set tempfile tmpdir/pr18374.o
+} else {
+ set tempfile [remote_download host tmpdir/pr18374.o]
+}
+
+readelf_test --debug-dump=loc $tempfile readelf.pr18374 {}
diff --git a/binutils/testsuite/binutils-all/readelf.pr18374 b/binutils/testsuite/binutils-all/readelf.pr18374
new file mode 100644
index 0000000..5be90f1
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.pr18374
@@ -0,0 +1,14 @@
+Contents of the .*ebug_loc section:
+
+ Warning: This section has relocations - addresses seen here may not be accurate.
+
+ Offset Begin End Expression
+ 0+0 0+0 0+0 .*
+ 0000000b 0+0 0+0 .*
+ 00000019 <End of list>
+ 00000021 0+0 0+0 .*
+ 0000002c 0+0 0+0 .*
+ 00000039 0+0 0+0 .*
+ 0000004e 0+0 0+0 .*
+ 00000063 <End of list>
+#pass