aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf.c59
2 files changed, 60 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 69c6361..9168147 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf.c b/bfd/elf.c
index e869a4e..b49d9a3 100644
--- 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