From 3e0b55542085e3720a8cc9374464e0ee8f624cfd Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Fri, 11 Mar 1994 09:03:07 +0000 Subject: [PATCH] * sunos.c (sunos_read_dynamic_info): Assume that dynamic info is always located at the start of the data section to allow recovery of the dynamic info from a stripped executable. * ecoff.c (ecoff_styp_to_sec_flags): Handle STYP_PDATA, STYP_XDATA and STYP_COMMENT. --- bfd/ChangeLog | 8 ++++++++ bfd/sunos.c | 35 ++++++++++------------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 541cb5f33d3..c2218904632 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +Fri Mar 11 00:34:59 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * sunos.c (sunos_read_dynamic_info): Assume that dynamic info + is always located at the start of the data section to allow + recovery of the dynamic info from a stripped executable. + * ecoff.c (ecoff_styp_to_sec_flags): Handle STYP_PDATA, STYP_XDATA + and STYP_COMMENT. + Wed Mar 9 17:17:53 1994 Jim Kingdon (kingdon@lioth.cygnus.com) * libbfd-in.h: Remove alloca cruft. It was missing some necessary diff --git a/bfd/sunos.c b/bfd/sunos.c index 9d292527d53..21e4b2fd3f7 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -96,32 +96,17 @@ sunos_read_dynamic_info (abfd) info->dynrel = NULL; obj_aout_dynamic_info (abfd) = (PTR) info; - /* We look for the __DYNAMIC symbol to locate the dynamic linking - information. It should be the first symbol if it is defined. If - we can't find it, don't sweat it. */ - if ((abfd->flags & DYNAMIC) == 0 - || bfd_get_symcount (abfd) <= 0 - || bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || (bfd_read ((PTR) &dynsym, 1, EXTERNAL_NLIST_SIZE, abfd) - != EXTERNAL_NLIST_SIZE) - || ((dynsym.e_type[0] & N_TYPE) != N_DATA - && (dynsym.e_type[0] & N_TYPE) != N_TEXT) - || bfd_seek (abfd, - obj_str_filepos (abfd) + GET_WORD (abfd, dynsym.e_strx), - SEEK_SET) != 0 - || bfd_read ((PTR) buf, 1, sizeof buf, abfd) != sizeof buf - || buf[sizeof buf - 1] != '\0' - || strcmp (buf, "__DYNAMIC") != 0) + /* This code used to look for the __DYNAMIC symbol to locate the dynamic + linking information. + However this inhibits recovering the dynamic symbols from a + stripped object file, so blindly assume that the dynamic linking + information is located at the start of the data section. + We could verify this assumption later by looking through the dynamic + symbols for the __DYNAMIC symbol. */ + if ((abfd->flags & DYNAMIC) == 0) return true; - - if ((dynsym.e_type[0] & N_TYPE) == N_DATA) - dynsec = obj_datasec (abfd); - else - dynsec = obj_textsec (abfd); - if (! bfd_get_section_contents (abfd, dynsec, (PTR) &dyninfo, - (GET_WORD (abfd, dynsym.e_value) - - bfd_get_section_vma (abfd, dynsec)), - sizeof dyninfo)) + if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo, + (file_ptr) 0, sizeof dyninfo)) return true; dynver = GET_WORD (abfd, dyninfo.ld_version); -- 2.30.2