From 7df428b11639efa0ec64b3f10a2472bd68316179 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 21 May 2007 06:36:01 +0000 Subject: [PATCH] binutils/ * objdump.c (disassemble_bytes): Ignore disassembler_needs_relocs for executables and shared libraries. ld/testsuite/ * ld-arm/emit-relocs1.d, ld-arm/emit-relocs1.s, * ld-arm/emit-relocs1-vxworks.d: New tests. * ld-arm/arm-elf.exp: Run them. * ld-arm/vxworks1.dd: Expect proper branch targets. --- binutils/ChangeLog | 5 +++++ binutils/objdump.c | 2 ++ ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-arm/arm-elf.exp | 2 ++ ld/testsuite/ld-arm/emit-relocs1-vxworks.d | 12 ++++++++++++ ld/testsuite/ld-arm/emit-relocs1.d | 12 ++++++++++++ ld/testsuite/ld-arm/emit-relocs1.s | 6 ++++++ ld/testsuite/ld-arm/vxworks1.dd | 6 +++--- 8 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 ld/testsuite/ld-arm/emit-relocs1-vxworks.d create mode 100644 ld/testsuite/ld-arm/emit-relocs1.d create mode 100644 ld/testsuite/ld-arm/emit-relocs1.s diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6a7d9456eb4..ee7ea305431 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2007-05-21 Richard Sandiford + + * objdump.c (disassemble_bytes): Ignore disassembler_needs_relocs + for executables and shared libraries. + 2007-05-18 Nathan Sidwell * objcopy.c (strip_main): Detect identical input and output file diff --git a/binutils/objdump.c b/binutils/objdump.c index 8927151affb..82a6a39bbee 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1377,6 +1377,8 @@ disassemble_bytes (struct disassemble_info * info, info->flags = 0; if (info->disassembler_needs_relocs + && (bfd_get_file_flags (aux->abfd) & EXEC_P) == 0 + && (bfd_get_file_flags (aux->abfd) & DYNAMIC) == 0 && *relppp < relppend) { bfd_signed_vma distance_to_rel; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 234ce37d788..4f67d3f22c9 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-05-21 Richard Sandiford + + * ld-arm/emit-relocs1.d, ld-arm/emit-relocs1.s, + * ld-arm/emit-relocs1-vxworks.d: New tests. + * ld-arm/arm-elf.exp: Run them. + * ld-arm/vxworks1.dd: Expect proper branch targets. + 2007-05-18 Joseph Myers * ld-elf/group.ld: Discard .reginfo. diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 942d67fc54b..af4921e02d1 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -41,6 +41,7 @@ if {[istarget "arm-*-vxworks"]} { } run_ld_link_tests $armvxworkstests run_dump_test "vxworks1-static" + run_dump_test "emit-relocs1-vxworks" } # Exclude non-ARM-ELF targets. @@ -175,6 +176,7 @@ run_dump_test "group-relocs-ldrs-bad" run_dump_test "group-relocs-ldc-bad" run_dump_test "thumb2-bl-as-thumb1-bad" run_dump_test "thumb2-bl-bad" +run_dump_test "emit-relocs1" # Exclude non-ARM-EABI targets. diff --git a/ld/testsuite/ld-arm/emit-relocs1-vxworks.d b/ld/testsuite/ld-arm/emit-relocs1-vxworks.d new file mode 100644 index 00000000000..6d84a4c349b --- /dev/null +++ b/ld/testsuite/ld-arm/emit-relocs1-vxworks.d @@ -0,0 +1,12 @@ +#source: emit-relocs1.s +#ld: -Ttext 0x10000 --defsym target=0xc000 -e0 --emit-relocs +#objdump: -dr +#... + +10000: e1a00000 nop .* + +10004: e1a00000 nop .* + +10008: e1a00000 nop .* + +1000c: e1a00000 nop .* + +10010: eaffeffa b c000 + +10010: R_ARM_PC24 target\+0xf+8 + +10014: eaffeffd b c010 + +10014: R_ARM_PC24 target\+0x8 diff --git a/ld/testsuite/ld-arm/emit-relocs1.d b/ld/testsuite/ld-arm/emit-relocs1.d new file mode 100644 index 00000000000..191cb52c867 --- /dev/null +++ b/ld/testsuite/ld-arm/emit-relocs1.d @@ -0,0 +1,12 @@ +#source: emit-relocs1.s +#ld: -Ttext 0x10000 --defsym target=0xc000 -e0 --emit-relocs +#objdump: -dr +#... + +10000: e1a00000 nop .* + +10004: e1a00000 nop .* + +10008: e1a00000 nop .* + +1000c: e1a00000 nop .* + +10010: eaffeffa b c000 + +10010: R_ARM_(JUMP|PC)24 target + +10014: eaffeffd b c010 + +10014: R_ARM_(JUMP|PC)24 target diff --git a/ld/testsuite/ld-arm/emit-relocs1.s b/ld/testsuite/ld-arm/emit-relocs1.s new file mode 100644 index 00000000000..8971d4dbfab --- /dev/null +++ b/ld/testsuite/ld-arm/emit-relocs1.s @@ -0,0 +1,6 @@ + nop + nop + nop + nop + b target + b target+16 diff --git a/ld/testsuite/ld-arm/vxworks1.dd b/ld/testsuite/ld-arm/vxworks1.dd index 40a50ea2346..044312295ab 100644 --- a/ld/testsuite/ld-arm/vxworks1.dd +++ b/ld/testsuite/ld-arm/vxworks1.dd @@ -26,11 +26,11 @@ Disassembly of section \.plt: Disassembly of section \.text: 00080c00 <_start>: - 80c00: ebffff08 bl 80428 <.*> + 80c00: ebffff08 bl 80828 <.*> 80c00: R_ARM_PC24 \.plt\+0x20 - 80c04: eb000000 bl 80c14 + 80c04: eb000000 bl 80c0c 80c04: R_ARM_PC24 sexternal\+0xfffffff8 - 80c08: eaffff00 b 80408 <.*> + 80c08: eaffff00 b 80810 <.*> 80c08: R_ARM_PC24 \.plt\+0x8 00080c0c : -- 2.30.2