This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / bfd / elflink.c
index 93155b11af79a45b47e5254697eb4e821183103c..8039b4fe35b006f8681f975549a5d8b42a8d23e3 100644 (file)
@@ -1,5 +1,5 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -157,18 +157,20 @@ _bfd_elf_create_dynamic_sections (abfd, info)
   if (! _bfd_elf_create_got_section (abfd, info))
     return false;
 
-  /* The .dynbss section is a place to put symbols which are defined
-     by dynamic objects, are referenced by regular objects, and are
-     not functions.  We must allocate space for them in the process
-     image and use a R_*_COPY reloc to tell the dynamic linker to
-     initialize them at run time.  The linker script puts the .dynbss
-     section into the .bss section of the final image.  */
-  s = bfd_make_section (abfd, ".dynbss");
-  if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
-    return false;
+  if (bed->want_dynbss)
+    {
+      /* The .dynbss section is a place to put symbols which are defined
+        by dynamic objects, are referenced by regular objects, and are
+        not functions.  We must allocate space for them in the process
+        image and use a R_*_COPY reloc to tell the dynamic linker to
+        initialize them at run time.  The linker script puts the .dynbss
+        section into the .bss section of the final image.  */
+      s = bfd_make_section (abfd, ".dynbss");
+      if (s == NULL
+         || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
+       return false;
 
-  /* The .rel[a].bss section holds copy relocs.  This section is not
+      /* The .rel[a].bss section holds copy relocs.  This section is not
      normally needed.  We need to create it here, though, so that the
      linker will map it to an output section.  We can't just create it
      only if we need it, because we will not know whether we need it
@@ -179,15 +181,16 @@ _bfd_elf_create_dynamic_sections (abfd, info)
      be needed, we can discard it later.  We will never need this
      section when generating a shared object, since they do not use
      copy relocs.  */
-  if (! info->shared)
-    {
-      s = bfd_make_section (abfd, 
-                           (bed->default_use_rela_p 
-                            ? ".rela.bss" : ".rel.bss")); 
-      if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-         || ! bfd_set_section_alignment (abfd, s, ptralign))
-       return false;
+      if (! info->shared)
+       {
+         s = bfd_make_section (abfd, 
+                               (bed->default_use_rela_p 
+                                ? ".rela.bss" : ".rel.bss")); 
+         if (s == NULL
+             || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+             || ! bfd_set_section_alignment (abfd, s, ptralign))
+           return false;
+       }
     }
 
   return true;
@@ -215,6 +218,25 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
       boolean copy;
       bfd_size_type indx;
 
+      /* XXX: The ABI draft says the linker must turn hidden and
+        internal symbols into STB_LOCAL symbols when producing the
+        DSO. However, if ld.so honors st_other in the dynamic table,
+        this would not be necessary.  */
+      switch (ELF_ST_VISIBILITY (h->other))
+       {
+       case STV_INTERNAL:
+       case STV_HIDDEN:
+         if (h->root.type != bfd_link_hash_undefined
+             && h->root.type != bfd_link_hash_undefweak)
+           {
+             h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+             return true;
+           }
+
+       default:
+         break;
+       }
+
       h->dynindx = elf_hash_table (info)->dynsymcount;
       ++elf_hash_table (info)->dynsymcount;
 
This page took 0.043343 seconds and 4 git commands to generate.