* elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there is
authorIan Lance Taylor <ian@airs.com>
Fri, 21 Mar 1997 18:09:12 +0000 (18:09 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 21 Mar 1997 18:09:12 +0000 (18:09 +0000)
no .rela.plt section, don't output a DT_PLTGOT dynamic entry.
Handles the case of a shared library with no function calls.

bfd/ChangeLog
bfd/elf32-sparc.c

index 5c0b69d795e59c9e86bf6f2b41392428aacfbbde..2c16ab5ff2320aa178b3dda870e05af4c6fc5cbd 100644 (file)
@@ -1,3 +1,8 @@
+Fri Mar 21 13:08:26 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there is
+       no .rela.plt section, don't output a DT_PLTGOT dynamic entry.
+
 Thu Mar 20 12:39:02 1997  Ian Lance Taylor  <ian@cygnus.com>
 
        Based on patches from Philippe De Muyter <phdm@info.ucl.ac.be>.
index 7cc0048aded0634cbd2db34b6077171603323f39..1db5f3a2c32a7e126f17048095c6d38d302b60ec 100644 (file)
@@ -1,5 +1,5 @@
 /* SPARC-specific support for 32-bit ELF
-   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -593,9 +593,17 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later
-     (although we could actually do it here).  */
+     (although we could actually do it here).  The STT_NOTYPE
+     condition is a hack specifically for the Oracle libraries
+     delivered for Solaris; for some inexplicable reason, they define
+     some of their functions as STT_NOTYPE when they really should be
+     STT_FUNC.  */
   if (h->type == STT_FUNC
-      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
+      || (h->type == STT_NOTYPE
+         && (h->root.type == bfd_link_hash_defined
+             || h->root.type == bfd_link_hash_defweak)
+         && (h->root.u.def.section->flags & SEC_CODE) != 0))
     {
       if (! elf_hash_table (info)->dynamic_sections_created)
        {
@@ -805,11 +813,14 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
            }
          else
            {
+             const char *outname;
              asection *target;
 
              /* If this relocation section applies to a read only
                 section, then we probably need a DT_TEXTREL entry.  */
-             target = bfd_get_section_by_name (output_bfd, name + 5);
+             outname = bfd_get_section_name (output_bfd,
+                                             s->output_section);
+             target = bfd_get_section_by_name (output_bfd, outname + 5);
              if (target != NULL
                  && (target->flags & SEC_READONLY) != 0)
                reltext = true;
@@ -862,12 +873,10 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
            return false;
        }
 
-      if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0))
-       return false;
-
       if (relplt)
        {
-         if (! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
+         if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
+             || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
              || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
              || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
            return false;
@@ -1263,8 +1272,10 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              outrel.r_offset = (rel->r_offset
                                 + input_section->output_section->vma
                                 + input_section->output_offset);
+             /* h->dynindx may be -1 if the symbol was marked to
+                 become local.  */
              if (h != NULL
-                 && (! info->symbolic
+                 && ((! info->symbolic && h->dynindx != -1)
                      || (h->elf_link_hash_flags
                          & ELF_LINK_HASH_DEF_REGULAR) == 0))
                {
This page took 0.032797 seconds and 4 git commands to generate.