* emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Ignore
authorAlan Modra <amodra@gmail.com>
Mon, 11 Apr 2005 14:26:46 +0000 (14:26 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 11 Apr 2005 14:26:46 +0000 (14:26 +0000)
as_needed libs that were not needed.
(gld${EMULATION_NAME}_check_needed): Likewise.

ld/ChangeLog
ld/emultempl/elf32.em

index 61afd9a6e23f9928d4f72f0bf566118149619709..c4d13d8a728becd643478eae0c3316da8e8b044a 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-11  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Ignore
+       as_needed libs that were not needed.
+       (gld${EMULATION_NAME}_check_needed): Likewise.
+
 2005-04-07  Nick Clifton  <nickc@redhat.com>
 
        * emultempl/m68kcoff.em: Include ldexp.h and ldlang.h so that
index 16464b54af02969bb24f1ff075a7e0f12fd39925..87edf6f0a456d0f56d32aeb6468d1f9a059f958e 100644 (file)
@@ -230,6 +230,9 @@ gld${EMULATION_NAME}_stat_needed (lang_input_statement_type *s)
     return;
   if (s->the_bfd == NULL)
     return;
+  if (s->as_needed
+      && (bfd_elf_get_dyn_lib_class (s->the_bfd) & DYN_AS_NEEDED) != 0)
+    return;
 
   if (bfd_stat (s->the_bfd, &st) != 0)
     {
@@ -737,6 +740,13 @@ gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s)
   if (global_found)
     return;
 
+  /* If this input file was an as-needed entry, and wasn't found to be
+     needed at the stage it was linked, then don't say we have loaded it.  */
+  if (s->as_needed
+      && (s->the_bfd == NULL
+         || (bfd_elf_get_dyn_lib_class (s->the_bfd) & DYN_AS_NEEDED) != 0))
+    return;
+
   if (s->filename != NULL)
     {
       const char *f;