From 34319c4355f0406836e05c850300509b101ea0e4 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Tue, 22 May 2007 15:05:12 +0000 Subject: [PATCH] 2007-05-22 Paul Brook bunutils/ * objdump.c (find_symbol_for_address): Merge section and target specific filtering code. ld/testsuite/ * ld-arm-mixed-lib.d: Update expected output. * ld-arm/arm-app.d: Ditto. * ld-arm/mixed-app.d: Ditto. * ld-arm/arm-lib-plt32.d: Ditto. * ld-arm/arm-app-abs32.d: Ditto. * ld-arm/mixed-app-v5.d: Ditto. * ld-arm/armthumb-lib.d: Ditto. * ld-arm/arm-lib.d: Ditto. gas/testsuite/ * gas/arm/backslash-at.d: Update expected output. --- binutils/ChangeLog | 5 +++ binutils/objdump.c | 63 ++++++++++++++++++------------------ gas/testsuite/ChangeLog | 4 +++ gas/testsuite/gas/arm/backslash-at.d | 2 +- ld/testsuite/ChangeLog | 11 +++++++ ld/testsuite/ld-arm/arm-app-abs32.d | 4 +-- ld/testsuite/ld-arm/arm-app.d | 4 +-- ld/testsuite/ld-arm/arm-lib-plt32.d | 4 +-- ld/testsuite/ld-arm/arm-lib.d | 4 +-- ld/testsuite/ld-arm/armthumb-lib.d | 4 +-- ld/testsuite/ld-arm/mixed-app-v5.d | 4 +-- ld/testsuite/ld-arm/mixed-app.d | 4 +-- ld/testsuite/ld-arm/mixed-lib.d | 4 +-- 13 files changed, 69 insertions(+), 48 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 920f61b8c2..9724584770 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2007-05-22 Paul Brook + + * objdump.c (find_symbol_for_address): Merge section and target + specific filtering code. + 2007-05-22 Nick Clifton * doc/binutils.texi: Use @copying around the copyright notice. diff --git a/binutils/objdump.c b/binutils/objdump.c index 82a6a39bbe..a8cad9bad2 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -687,6 +687,7 @@ find_symbol_for_address (bfd_vma vma, bfd *abfd; asection *sec; unsigned int opb; + bfd_boolean want_section; if (sorted_symcount < 1) return NULL; @@ -732,15 +733,19 @@ find_symbol_for_address (bfd_vma vma, Note that this may be wrong for some symbol references if the sections have overlapping memory ranges, but in that case there's no way to tell what's desired without looking at the relocation - table. */ - if (sorted_syms[thisplace]->section != sec - && (aux->require_sec - || ((abfd->flags & HAS_RELOC) != 0 - && vma >= bfd_get_section_vma (abfd, sec) - && vma < (bfd_get_section_vma (abfd, sec) - + bfd_section_size (abfd, sec) / opb)))) + table. + + Also give the target a chance to reject symbols. */ + want_section = (aux->require_sec + || ((abfd->flags & HAS_RELOC) != 0 + && vma >= bfd_get_section_vma (abfd, sec) + && vma < (bfd_get_section_vma (abfd, sec) + + bfd_section_size (abfd, sec) / opb))); + if ((sorted_syms[thisplace]->section != sec && want_section) + || !info->symbol_is_valid (sorted_syms[thisplace], info)) { long i; + long newplace; for (i = thisplace + 1; i < sorted_symcount; i++) { @@ -750,27 +755,36 @@ find_symbol_for_address (bfd_vma vma, } --i; + newplace = sorted_symcount; for (; i >= 0; i--) { - if (sorted_syms[i]->section == sec - && (i == 0 - || sorted_syms[i - 1]->section != sec - || (bfd_asymbol_value (sorted_syms[i]) - != bfd_asymbol_value (sorted_syms[i - 1])))) + if ((sorted_syms[i]->section == sec || !want_section) + && info->symbol_is_valid (sorted_syms[i], info)) { - thisplace = i; - break; + if (newplace == sorted_symcount) + newplace = i; + + if (bfd_asymbol_value (sorted_syms[i]) + != bfd_asymbol_value (sorted_syms[newplace])) + break; + + /* Remember this symbol and keep searching until we reach + an earlier address. */ + newplace = i; } } - if (sorted_syms[thisplace]->section != sec) + if (newplace != sorted_symcount) + thisplace = newplace; + else { /* We didn't find a good symbol with a smaller value. Look for one with a larger value. */ for (i = thisplace + 1; i < sorted_symcount; i++) { - if (sorted_syms[i]->section == sec) + if ((sorted_syms[i]->section == sec || !want_section) + && info->symbol_is_valid (sorted_syms[i], info)) { thisplace = i; break; @@ -778,25 +792,12 @@ find_symbol_for_address (bfd_vma vma, } } - if (sorted_syms[thisplace]->section != sec - && (aux->require_sec - || ((abfd->flags & HAS_RELOC) != 0 - && vma >= bfd_get_section_vma (abfd, sec) - && vma < (bfd_get_section_vma (abfd, sec) - + bfd_section_size (abfd, sec))))) + if ((sorted_syms[thisplace]->section != sec && want_section) + || !info->symbol_is_valid (sorted_syms[thisplace], info)) /* There is no suitable symbol. */ return NULL; } - /* Give the target a chance to reject the symbol. */ - while (! info->symbol_is_valid (sorted_syms [thisplace], info)) - { - ++ thisplace; - if (thisplace >= sorted_symcount - || bfd_asymbol_value (sorted_syms [thisplace]) > vma) - return NULL; - } - if (place != NULL) *place = thisplace; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 10270bf517..8e60e10a2e 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-05-22 Paul Brook + + * gas/arm/backslash-at.d: Update expected output. + 2007-05-17 H.J. Lu 2003-06-05 Michal Ludvig diff --git a/gas/testsuite/gas/arm/backslash-at.d b/gas/testsuite/gas/arm/backslash-at.d index a51def5577..f73a373b1d 100644 --- a/gas/testsuite/gas/arm/backslash-at.d +++ b/gas/testsuite/gas/arm/backslash-at.d @@ -4,7 +4,7 @@ .*: file format .*arm.* Disassembly of section .text: -00000000 <.text> 615c .short 0x615c +00000000 615c .short 0x615c 00000002 e3a00000 mov r0, #0 ; 0x0 00000006 e3a00000 mov r0, #0 ; 0x0 0000000a e3a00000 mov r0, #0 ; 0x0 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 4f67d3f22c..c4662f7fd8 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2007-05-22 Paul Brook + + * ld-arm-mixed-lib.d: Update expected output. + * ld-arm/arm-app.d: Ditto. + * ld-arm/mixed-app.d: Ditto. + * ld-arm/arm-lib-plt32.d: Ditto. + * ld-arm/arm-app-abs32.d: Ditto. + * ld-arm/mixed-app-v5.d: Ditto. + * ld-arm/armthumb-lib.d: Ditto. + * ld-arm/arm-lib.d: Ditto. + 2007-05-21 Richard Sandiford * ld-arm/emit-relocs1.d, ld-arm/emit-relocs1.s, diff --git a/ld/testsuite/ld-arm/arm-app-abs32.d b/ld/testsuite/ld-arm/arm-app-abs32.d index 0c5e2837f0..ce684d44e5 100644 --- a/ld/testsuite/ld-arm/arm-app-abs32.d +++ b/ld/testsuite/ld-arm/arm-app-abs32.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <_start-0x10> .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* .* @@ -20,7 +20,7 @@ Disassembly of section .text: .* <_start>: .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: e59f0004 ldr r0, \[pc, #4\] ; .* <.text\+0x14> + .*: e59f0004 ldr r0, \[pc, #4\] ; .* <_start\+0x14> .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr .*: .* .* diff --git a/ld/testsuite/ld-arm/arm-app.d b/ld/testsuite/ld-arm/arm-app.d index a4ac93edfa..3ed76f06e9 100644 --- a/ld/testsuite/ld-arm/arm-app.d +++ b/ld/testsuite/ld-arm/arm-app.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <_start-0x10> .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -27,7 +27,7 @@ Disassembly of section .text: .* : .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: ebfffff4 bl .* <.text-0xc> + .*: ebfffff4 bl .* <_start-0xc> .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-lib-plt32.d b/ld/testsuite/ld-arm/arm-lib-plt32.d index 21165b241b..d1b7944f64 100644 --- a/ld/testsuite/ld-arm/arm-lib-plt32.d +++ b/ld/testsuite/ld-arm/arm-lib-plt32.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -20,7 +20,7 @@ Disassembly of section .text: .* : .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: ebfffff9 bl .* <\.text-0xc> + .*: ebfffff9 bl .* .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-lib.d b/ld/testsuite/ld-arm/arm-lib.d index 20fa8bcdc3..9d25bbbfa7 100644 --- a/ld/testsuite/ld-arm/arm-lib.d +++ b/ld/testsuite/ld-arm/arm-lib.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -20,7 +20,7 @@ Disassembly of section .text: .* : .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: ebfffff9 bl .* <\.text-0xc> + .*: ebfffff9 bl .* .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/armthumb-lib.d b/ld/testsuite/ld-arm/armthumb-lib.d index b00eb0cbfc..bd45c87fce 100644 --- a/ld/testsuite/ld-arm/armthumb-lib.d +++ b/ld/testsuite/ld-arm/armthumb-lib.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -20,7 +20,7 @@ Disassembly of section .text: .* : .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: ebfffff. bl .* <.text-0x..?> + .*: ebfffff. bl .* .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr .*: e1a00000 nop \(mov r0,r0\) diff --git a/ld/testsuite/ld-arm/mixed-app-v5.d b/ld/testsuite/ld-arm/mixed-app-v5.d index 6498021532..88317d2d75 100644 --- a/ld/testsuite/ld-arm/mixed-app-v5.d +++ b/ld/testsuite/ld-arm/mixed-app-v5.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <_start-0x1c> .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -48,7 +48,7 @@ Disassembly of section .text: .* : .*: b500 push {lr} - .*: f7ff efc. blx .* <.text-0x..> + .*: f7ff efc. blx .* <_start-0x..> .*: bd00 pop {pc} .*: 4770 bx lr .*: 46c0 nop \(mov r8, r8\) diff --git a/ld/testsuite/ld-arm/mixed-app.d b/ld/testsuite/ld-arm/mixed-app.d index 46fc789b8f..a3679ddf61 100644 --- a/ld/testsuite/ld-arm/mixed-app.d +++ b/ld/testsuite/ld-arm/mixed-app.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <_start-0x2c> .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -50,7 +50,7 @@ Disassembly of section .text: .* : .*: b500 push {lr} - .*: f7ff ffc. bl .* <.text-0x..> + .*: f7ff ffc. bl .* <_start-0x..> .*: bd00 pop {pc} .*: 4770 bx lr .*: 46c0 nop \(mov r8, r8\) diff --git a/ld/testsuite/ld-arm/mixed-lib.d b/ld/testsuite/ld-arm/mixed-lib.d index 33f31df33e..d815e51b9a 100644 --- a/ld/testsuite/ld-arm/mixed-lib.d +++ b/ld/testsuite/ld-arm/mixed-lib.d @@ -8,7 +8,7 @@ Disassembly of section .plt: .* <.plt>: .*: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) - .*: e59fe004 ldr lr, \[pc, #4\] ; .* <\.plt\+0x10> + .*: e59fe004 ldr lr, \[pc, #4\] ; .* .*: e08fe00e add lr, pc, lr .*: e5bef008 ldr pc, \[lr, #8\]! .*: .* @@ -20,7 +20,7 @@ Disassembly of section .text: .* : .*: e1a0c00d mov ip, sp .*: e92dd800 push {fp, ip, lr, pc} - .*: ebfffff. bl .* <.text-0x..?> + .*: ebfffff. bl .* .*: e89d6800 ldm sp, {fp, sp, lr} .*: e12fff1e bx lr .*: e1a00000 nop \(mov r0,r0\) -- 2.11.0