PR binutils/11512
authorNick Clifton <nickc@redhat.com>
Tue, 27 Apr 2010 14:42:50 +0000 (14:42 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 27 Apr 2010 14:42:50 +0000 (14:42 +0000)
        * coffgen.c (coff_find_nearest_line): Incldue the section address
        of function name symbols in address comparisons.

bfd/ChangeLog
bfd/coffgen.c

index 3d9da9bdc7bb26a8dfaff877c26646a3e748ca29..411e043c83eb3fdf37d79478014347fcda2b68b8 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-27  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/11512
+       * coffgen.c (coff_find_nearest_line): Incldue the section address
+       of function name symbols in address comparisons.
+
 2010-04-27  Nick Clifton  <nickc@redhat.com>
 
        * po/fr.po: Updated French translation.
index 63053a1dec997fcda161c2364e6932bcb46103a1..fc82d57dd73dd520811563497bf79f7e87708a4c 100644 (file)
@@ -2152,6 +2152,7 @@ coff_find_nearest_line (bfd *abfd,
       maxdiff = (bfd_vma) 0 - (bfd_vma) 1;
       while (1)
        {
+         bfd_vma file_addr;
          combined_entry_type *p2;
 
          for (p2 = p + 1 + p->u.syment.n_numaux;
@@ -2170,11 +2171,16 @@ coff_find_nearest_line (bfd *abfd,
                }
            }
 
+         file_addr = (bfd_vma) p2->u.syment.n_value;
+         /* PR 11512: Include the section address of the function name symbol.  */
+         if (p2->u.syment.n_scnum > 0)
+           file_addr += coff_section_from_bfd_index (abfd,
+                                                     p2->u.syment.n_scnum)->vma;
          /* We use <= MAXDIFF here so that if we get a zero length
              file, we actually use the next file entry.  */
          if (p2 < pend
-             && offset + sec_vma >= (bfd_vma) p2->u.syment.n_value
-             && offset + sec_vma - (bfd_vma) p2->u.syment.n_value <= maxdiff)
+             && offset + sec_vma >= file_addr
+             && offset + sec_vma - file_addr <= maxdiff)
            {
              *filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
              maxdiff = offset + sec_vma - p2->u.syment.n_value;