From d1c4b12b9d48d9266b78e2c22d70aa25830b9f8f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 15 May 2015 11:21:38 +0100 Subject: 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. --- binutils/testsuite/binutils-all/pr18374.s | 234 ++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 binutils/testsuite/binutils-all/pr18374.s (limited to 'binutils/testsuite/binutils-all/pr18374.s') diff --git a/binutils/testsuite/binutils-all/pr18374.s b/binutils/testsuite/binutils-all/pr18374.s new file mode 100644 index 00000000000..793fb70553a --- /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 -- cgit v1.2.3-65-gdbad