Tue Jul 11 12:29:49 1995 Rick Sladkey <jrs@world.std.com>
authorIan Lance Taylor <ian@airs.com>
Tue, 11 Jul 1995 16:31:39 +0000 (16:31 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 11 Jul 1995 16:31:39 +0000 (16:31 +0000)
* elf.c (_bfd_elf_find_nearest_line): Handle the simple case where
there is no debugging information.

bfd/ChangeLog
bfd/elf.c

index 69c6361a36209daa266e50977fed8f3795bad558..91681473439a7edba2f8fb78d091392590920561 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 11 12:29:49 1995  Rick Sladkey  <jrs@world.std.com>
+
+       * elf.c (_bfd_elf_find_nearest_line): Handle the simple case where
+       there is no debugging information.
+
 Mon Jul 10 11:45:55 1995  Ken Raeburn  <raeburn@cygnus.com>
 
        * makefile.dos (OBJS): Add binary.o and tekhex.o.  From DJ
@@ -5,6 +10,10 @@ Mon Jul 10 11:45:55 1995  Ken Raeburn  <raeburn@cygnus.com>
 
 Mon Jul 10 11:09:58 1995  Ian Lance Taylor  <ian@cygnus.com>
 
+       * linker.c (set_symbol_from_hash): bfd_link_hash_new case: Don't
+       abort; it can happen for constructor symbols when not building
+       constructors.
+
        * coff-i960.c (coff_i960_relocate): Correct typo: use ! on strcmp,
        not on string.
        * cofflink.c (_bfd_coff_generic_relocate_section): Remove unused
index e869a4eba9992e72c70a67bcd700e399d4eb26e6..b49d9a3dd2e5827702568d84585b788ee3e0808e 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
 
@@ -2589,14 +2589,17 @@ _bfd_elf_set_arch_mach (abfd, arch, machine)
   return bfd_default_set_arch_mach (abfd, arch, machine);
 }
 
+/* Find the nearest line to a particular section and offset, for error
+   reporting.  */
+
 boolean
 _bfd_elf_find_nearest_line (abfd,
-                      section,
-                      symbols,
-                      offset,
-                      filename_ptr,
-                      functionname_ptr,
-                      line_ptr)
+                           section,
+                           symbols,
+                           offset,
+                           filename_ptr,
+                           functionname_ptr,
+                           line_ptr)
      bfd *abfd;
      asection *section;
      asymbol **symbols;
@@ -2605,7 +2608,47 @@ _bfd_elf_find_nearest_line (abfd,
      CONST char **functionname_ptr;
      unsigned int *line_ptr;
 {
-  return false;
+  const char *filename;
+  asymbol *func;
+  asymbol **p;
+
+  if (symbols == NULL)
+    return false;
+
+  filename = NULL;
+  func = NULL;
+
+  for (p = symbols; *p != NULL; p++)
+    {
+      elf_symbol_type *q;
+
+      q = (elf_symbol_type *) *p;
+
+      if (bfd_get_section (&q->symbol) != section)
+       continue;
+
+      switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
+       {
+       default:
+         break;
+       case STT_FILE:
+         filename = bfd_asymbol_name (&q->symbol);
+         break;
+       case STT_FUNC:
+         if (func == NULL
+             || q->symbol.value <= offset)
+           func = (asymbol *) q;
+         break;
+       }
+    }
+
+  if (func == NULL)
+    return false;
+
+  *filename_ptr = filename;
+  *functionname_ptr = bfd_asymbol_name (func);
+  *line_ptr = 0;
+  return true;
 }
 
 int
This page took 0.03197 seconds and 4 git commands to generate.