* elflink.h (elf_link_add_object_symbols): Work around bogus SH_LINK
authorJeff Law <law@redhat.com>
Thu, 2 Sep 1999 23:44:54 +0000 (23:44 +0000)
committerJeff Law <law@redhat.com>
Thu, 2 Sep 1999 23:44:54 +0000 (23:44 +0000)
        field in hpux11 shared libraries.

bfd/ChangeLog
bfd/elflink.h

index c23850f53a834453ce81da6764104c1765be89cf..f45eafc8f77bf29922a47eb1473ddbbc628581d5 100644 (file)
@@ -1,3 +1,8 @@
+Thu Sep  2 17:41:20 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * elflink.h (elf_link_add_object_symbols): Work around bogus SH_LINK
+       field in hpux11 shared libraries.
+
 1999-09-02  Nick Clifton  <nickc@cygnus.com>
 
        * elflink.h (elf_gc_record_vtentry): Fix memory leak.
index 35bf885d82cc21c931a3198be4177597ef885290..b7b5b23998fadaaf9062295c6883514c4a2467aa 100644 (file)
@@ -954,6 +954,23 @@ elf_link_add_object_symbols (abfd, info)
            goto error_return;
          link = elf_elfsections (abfd)[elfsec]->sh_link;
 
+         {
+           /* The shared libraries distributed with hpux11 have a bogus
+              sh_link field for the ".dynamic" section.  This code detects
+              when LINK refers to a section that is not a string table and
+              tries to find the string table for the ".dynsym" section
+              instead.  */
+           Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[link];
+           if (hdr->sh_type != SHT_STRTAB)
+             {
+               asection *s = bfd_get_section_by_name (abfd, ".dynsym");
+               int elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
+               if (elfsec == -1)
+                 goto error_return;
+               link = elf_elfsections (abfd)[elfsec]->sh_link;
+             }
+         }
+
          extdyn = dynbuf;
          extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn);
          for (; extdyn < extdynend; extdyn++)