* elflink.h (elf_link_input_bfd): Discard local symbols that are
[deliverable/binutils-gdb.git] / bfd / elflink.h
index 75da5a5871be06c68591bd7e759f12c4b49aac64..dd5b4db72637be11cdedeb8c1889fc4d7f7163c9 100644 (file)
@@ -1354,13 +1354,13 @@ static const size_t elf_buckets[] =
 boolean
 NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
                                     export_dynamic, filter_shlib,
-                                    auxiliary_filter_shlib, info, sinterpptr)
+                                    auxiliary_filters, info, sinterpptr)
      bfd *output_bfd;
      const char *soname;
      const char *rpath;
      boolean export_dynamic;
      const char *filter_shlib;
-     const char *auxiliary_filter_shlib;
+     const char * const *auxiliary_filters;
      struct bfd_link_info *info;
      asection **sinterpptr;
 {
@@ -1448,15 +1448,20 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
            return false;
        }
 
-      if (auxiliary_filter_shlib != NULL)
+      if (auxiliary_filters != NULL)
        {
-         bfd_size_type indx;
+         const char * const *p;
 
-         indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
-                                    auxiliary_filter_shlib, true, true);
-         if (indx == (bfd_size_type) -1
-             || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
-           return false;
+         for (p = auxiliary_filters; *p != NULL; p++)
+           {
+             bfd_size_type indx;
+
+             indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
+                                        *p, true, true);
+             if (indx == (bfd_size_type) -1
+                 || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
+               return false;
+           }
        }
 
       /* Find all symbols which were defined in a dynamic object and make
@@ -2876,9 +2881,20 @@ elf_link_input_bfd (finfo, input_bfd)
       if (finfo->info->discard == discard_all)
        continue;
 
+      /* If this symbol is defined in a section which we are
+         discarding, we don't need to keep it.  For the benefit of the
+         MIPS ELF linker, we check SEC_EXCLUDE as well as linker_mark.  */
+      if (isym->st_shndx > 0
+         && isym->st_shndx < SHN_LORESERVE
+         && isec != NULL
+         && (! isec->linker_mark
+             || (! finfo->info->relocateable
+                 && (isec->flags & SEC_EXCLUDE) != 0)))
+       continue;
+
       /* Get the name of the symbol.  */
       name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
-                                         isym->st_name);
+                                             isym->st_name);
       if (name == NULL)
        return false;
 
This page took 0.024768 seconds and 4 git commands to generate.