Remove bfd stub function casts.
[deliverable/binutils-gdb.git] / bfd / elflink.c
index e3751fa122cf936a3c277ddd36631a5b0d2647f2..22d7d2679ad02cdd667e70f6a391de93428c59bc 100644 (file)
@@ -881,9 +881,9 @@ elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
 /* Return true if the dynamic symbol for a given section should be
    omitted when creating a shared library.  */
 bfd_boolean
-_bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
-                                  struct bfd_link_info *info,
-                                  asection *p)
+_bfd_elf_omit_section_dynsym_default (bfd *output_bfd ATTRIBUTE_UNUSED,
+                                     struct bfd_link_info *info,
+                                     asection *p)
 {
   struct elf_link_hash_table *htab;
   asection *ip;
@@ -913,6 +913,15 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
     }
 }
 
+bfd_boolean
+_bfd_elf_omit_section_dynsym_all
+    (bfd *output_bfd ATTRIBUTE_UNUSED,
+     struct bfd_link_info *info ATTRIBUTE_UNUSED,
+     asection *p ATTRIBUTE_UNUSED)
+{
+  return TRUE;
+}
+
 /* Assign dynsym indices.  In a shared library we generate a section
    symbol for each output section, which come first.  Next come symbols
    which have been forced to local binding.  Then all of the back-end
@@ -5422,7 +5431,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abfd,
   len = strlen (name);
   copy = (char *) bfd_alloc (abfd, len);
   if (copy == NULL)
-    return (struct elf_link_hash_entry *) 0 - 1;
+    return (struct elf_link_hash_entry *) -1;
 
   first = p - name + 1;
   memcpy (copy, name, first);
@@ -5520,7 +5529,7 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
            }
 
          h = archive_symbol_lookup (abfd, info, symdef->name);
-         if (h == (struct elf_link_hash_entry *) 0 - 1)
+         if (h == (struct elf_link_hash_entry *) -1)
            goto error_return;
 
          if (h == NULL)
@@ -6901,7 +6910,7 @@ _bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info)
 
   for (s = output_bfd->sections; s != NULL; s = s->next)
     if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
-       && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+       && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
        elf_hash_table (info)->text_index_section = s;
        break;
@@ -6919,7 +6928,7 @@ _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
      _bfd_elf_link_omit_section_dynsym.  */
   for (s = output_bfd->sections; s != NULL; s = s->next)
     if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
-       && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+       && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
        elf_hash_table (info)->data_index_section = s;
        break;
@@ -6928,7 +6937,7 @@ _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
   for (s = output_bfd->sections; s != NULL; s = s->next)
     if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY))
         == (SEC_ALLOC | SEC_READONLY))
-       && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+       && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
        elf_hash_table (info)->text_index_section = s;
        break;
@@ -11618,6 +11627,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
          else
            o->flags |= SEC_EXCLUDE;
        }
+      else if ((o->flags & SEC_GROUP) != 0 && o->size == 0)
+       {
+         /* Remove empty group section from linker output.  */
+         o->flags |= SEC_EXCLUDE;
+         bfd_section_list_remove (abfd, o);
+         abfd->section_count--;
+       }
     }
 
   /* Count up the number of relocations we will output for each output
@@ -14338,8 +14354,9 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
   if (h != NULL
       && (h->root.type == bfd_link_hash_undefined
          || h->root.type == bfd_link_hash_undefweak
-         || (h->ref_regular && !h->def_regular)))
+         || ((h->ref_regular || h->def_dynamic) && !h->def_regular)))
     {
+      bfd_boolean was_dynamic = h->ref_dynamic || h->def_dynamic;
       h->root.type = bfd_link_hash_defined;
       h->root.u.def.section = sec;
       h->root.u.def.value = 0;
@@ -14354,8 +14371,13 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
          bed = get_elf_backend_data (info->output_bfd);
          (*bed->elf_backend_hide_symbol) (info, h, TRUE);
        }
-      else if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
-       h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED;
+      else
+       {
+         if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+           h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED;
+         if (was_dynamic)
+           bfd_elf_link_record_dynamic_symbol (info, h);
+       }
       return &h->root;
     }
   return NULL;
This page took 0.027285 seconds and 4 git commands to generate.