2007-05-22 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 22 May 2007 15:05:12 +0000 (15:05 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 22 May 2007 15:05:12 +0000 (15:05 +0000)
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.

13 files changed:
binutils/ChangeLog
binutils/objdump.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/backslash-at.d
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-app-abs32.d
ld/testsuite/ld-arm/arm-app.d
ld/testsuite/ld-arm/arm-lib-plt32.d
ld/testsuite/ld-arm/arm-lib.d
ld/testsuite/ld-arm/armthumb-lib.d
ld/testsuite/ld-arm/mixed-app-v5.d
ld/testsuite/ld-arm/mixed-app.d
ld/testsuite/ld-arm/mixed-lib.d

index 920f61b8c23688688585334c5b70b664d3e0e138..9724584770f6cac1aadc9733bf3254ba67352019 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-22  Paul Brook  <paul@codesourcery.com>
+
+       * objdump.c (find_symbol_for_address): Merge section and target
+       specific filtering code.
+
 2007-05-22  Nick Clifton  <nickc@redhat.com>
 
        * doc/binutils.texi: Use @copying around the copyright notice.
index 82a6a39bbeec890320a21b0717b1344fe59c32bc..a8cad9bad20d3e8f20f69ca943619095868bd64c 100644 (file)
@@ -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;
 
index 10270bf517723165659b5da3dbee80914b0bfbaf..8e60e10a2ead1bb0d09c82319922f3f73ed07443 100644 (file)
@@ -1,3 +1,7 @@
+2007-05-22  Paul Brook  <paul@codesourcery.com>
+
+       * gas/arm/backslash-at.d: Update expected output.
+
 2007-05-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        2003-06-05  Michal Ludvig  <mludvig@suse.cz>
index a51def5577cdadd258e0baf4cb33b7a0d8384ac3..f73a373b1dee8c53f7797182b0e337b804ea9e5f 100644 (file)
@@ -4,7 +4,7 @@
 .*:     file format .*arm.*
 
 Disassembly of section .text:
-00000000 <.text> 615c          .short  0x615c
+00000000 <foo-0x2> 615c        .short  0x615c
 00000002 <foo> e3a00000        mov     r0, #0  ; 0x0
 00000006 <foo\+0x4> e3a00000   mov     r0, #0  ; 0x0
 0000000a <foo\+0x8> e3a00000   mov     r0, #0  ; 0x0
index 4f67d3f22c9303318ee4412a173fd2ed7760278c..c4662f7fd823d4ab456a76de5e008f91ab60beee 100644 (file)
@@ -1,3 +1,14 @@
+2007-05-22  Paul Brook  <paul@codesourcery.com>
+
+       * 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  <richard@codesourcery.com>
 
        * ld-arm/emit-relocs1.d, ld-arm/emit-relocs1.s,
index 0c5e2837f00ceaae9885f2ca0e5dc5f11b267ea6..ce684d44e506067657b26ffe1f876f003b581556 100644 (file)
@@ -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
     .*:        .*      .*
index a4ac93edfaa24312edbf49afe8dbb54ad9e67e0e..3ed76f06e9bfe7603198f08d447458e92dfb43e8 100644 (file)
@@ -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:
 .* <app_func>:
  .*:   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
 
index 21165b241becb08e8811ef5857fb6a41c4299e88..d1b7944f643cbe53774dc979a7dc0b00f7b6dd08 100644 (file)
@@ -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\]  ; .* <lib_func1-0x10>
  .*:   e08fe00e        add     lr, pc, lr
  .*:   e5bef008        ldr     pc, \[lr, #8\]!
  .*:   .*
@@ -20,7 +20,7 @@ Disassembly of section .text:
 .* <lib_func1>:
  .*:   e1a0c00d        mov     ip, sp
  .*:   e92dd800        push    {fp, ip, lr, pc}
- .*:   ebfffff9        bl      .* <\.text-0xc>
+ .*:   ebfffff9        bl      .* <lib_func1-0xc>
  .*:   e89d6800        ldm     sp, {fp, sp, lr}
  .*:   e12fff1e        bx      lr
 
index 20fa8bcdc3735b2a81934aff743181bf1532834f..9d25bbbfa78f8e5303fc59a74b9934fda336b71e 100644 (file)
@@ -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\]  ; .* <lib_func1-0x10>
  .*:   e08fe00e        add     lr, pc, lr
  .*:   e5bef008        ldr     pc, \[lr, #8\]!
  .*:   .*
@@ -20,7 +20,7 @@ Disassembly of section .text:
 .* <lib_func1>:
  .*:   e1a0c00d        mov     ip, sp
  .*:   e92dd800        push    {fp, ip, lr, pc}
- .*:   ebfffff9        bl      .* <\.text-0xc>
+ .*:   ebfffff9        bl      .* <lib_func1-0xc>
  .*:   e89d6800        ldm     sp, {fp, sp, lr}
  .*:   e12fff1e        bx      lr
 
index b00eb0cbfce9e619ce02c5b663b470f97ac39f44..bd45c87fce0c503d260827362066a486e2598a6d 100644 (file)
@@ -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\]  ; .* <lib_func1-0x1c>
  .*:   e08fe00e        add     lr, pc, lr
  .*:   e5bef008        ldr     pc, \[lr, #8\]!
  .*:   .*
@@ -20,7 +20,7 @@ Disassembly of section .text:
 .* <lib_func1>:
  .*:   e1a0c00d        mov     ip, sp
  .*:   e92dd800        push    {fp, ip, lr, pc}
- .*:   ebfffff.        bl      .* <.text-0x..?>
+ .*:   ebfffff.        bl      .* <lib_func1-0x..?>
  .*:   e89d6800        ldm     sp, {fp, sp, lr}
  .*:   e12fff1e        bx      lr
  .*:   e1a00000        nop                     \(mov r0,r0\)
index 6498021532ebfb37616c95f7ee38a2e150068cb0..88317d2d75eac1d861736ad3436fcc6a22aeeb1b 100644 (file)
@@ -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:
 
 .* <app_tfunc>:
  .*:   b500            push    {lr}
- .*:   f7ff efc.       blx     .* <.text-0x..>
+ .*:   f7ff efc.       blx     .* <_start-0x..>
  .*:   bd00            pop     {pc}
  .*:   4770            bx      lr
  .*:   46c0            nop                     \(mov r8, r8\)
index 46fc789b8fb18088b63656a21b9a13cef17c041e..a3679ddf616f10e54c09a383b9972dd0a6e7810d 100644 (file)
@@ -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:
 
 .* <app_tfunc>:
  .*:   b500            push    {lr}
- .*:   f7ff ffc.       bl      .* <.text-0x..>
+ .*:   f7ff ffc.       bl      .* <_start-0x..>
  .*:   bd00            pop     {pc}
  .*:   4770            bx      lr
  .*:   46c0            nop                     \(mov r8, r8\)
index 33f31df33e25ee1f3f845073f409c017c8732c8f..d815e51b9a0df7c3c3e8b8003c17796767fd3030 100644 (file)
@@ -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\]  ; .* <lib_func1-0x1c>
  .*:   e08fe00e        add     lr, pc, lr
  .*:   e5bef008        ldr     pc, \[lr, #8\]!
  .*:   .*
@@ -20,7 +20,7 @@ Disassembly of section .text:
 .* <lib_func1>:
  .*:   e1a0c00d        mov     ip, sp
  .*:   e92dd800        push    {fp, ip, lr, pc}
- .*:   ebfffff.        bl      .* <.text-0x..?>
+ .*:   ebfffff.        bl      .* <lib_func1-0x..?>
  .*:   e89d6800        ldm     sp, {fp, sp, lr}
  .*:   e12fff1e        bx      lr
  .*:   e1a00000        nop                     \(mov r0,r0\)