From 506af7a79c56669ddd04f9da63c2d48d048615a6 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 9 Feb 1995 19:16:47 +0000 Subject: * somread.c (som_symtab_read): Handle dynamic relocation for both text and data symbols. (som_symfile_offsets): If objfile is a shared library, then get text and data offsets from the shared library structures. * somsolib.c (som_solib_add): Copy the bfd pointer from the objfile rather than reopening the file again. (som_solib_section_offsets): New function. * somsolib.h (som_solib_section_offsets): Declare. --- gdb/somsolib.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'gdb/somsolib.c') diff --git a/gdb/somsolib.c b/gdb/somsolib.c index 41b6c2b..a426542 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -338,8 +338,7 @@ som_solib_add (arg_string, from_tty, target) addr = (CORE_ADDR)new_so->som_solib.next; new_so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0); - new_so->abfd = bfd_openr (name, gnutarget); - new_so->abfd->cacheable = true; + new_so->abfd = new_so->objfile->obfd; if (!bfd_check_format (new_so->abfd, bfd_object)) { @@ -571,6 +570,43 @@ som_solib_get_got_by_pc (addr) return got_value; } +int +som_solib_section_offsets (objfile, offsets) + struct objfile *objfile; + struct section_offsets *offsets; +{ + struct so_list *so_list = so_list_head; + + while (so_list) + { + /* Oh what a pain! We need the offsets before so_list->objfile + is valid. The BFDs will never match. Make a best guess. */ + if (!strcmp (so_list->som_solib.name, objfile->name)) + { + asection *private_section; + + /* The text offset is easy. */ + ANOFFSET (offsets, 0) = so_list->som_solib.text_addr; + + /* We should look at presumed_dp in the SOM header, but + that's not easily available. This should be OK though. */ + private_section = bfd_get_section_by_name (objfile->obfd, + "$PRIVATE$"); + if (!private_section) + { + warning ("Unable to find $PRIVATE$ in shared library!"); + ANOFFSET (offsets, 1) = 0; + return 1; + } + ANOFFSET (offsets, 1) = (so_list->som_solib.data_start + - private_section->vma); + return 1; + } + so_list = so_list->next; + } + return 0; +} + /* Dump information about all the currently loaded shared libraries. */ static void -- cgit v1.1