summaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-04-11 14:26:46 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-04-11 14:26:46 +0000
commit40661e49374fbfeacca244e7691f3e2928430b9c (patch)
tree9ff9b5102486230e025d77374a7fb25249eb2db3 /ld/emultempl
parenta3cdf4438f9d283d64de2ea5aea283ba0a245347 (diff)
downloadbinutils-redhat-40661e49374fbfeacca244e7691f3e2928430b9c.tar.gz
* emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Ignore
as_needed libs that were not needed. (gld${EMULATION_NAME}_check_needed): Likewise.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em10
1 files changed, 10 insertions, 0 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 16464b54af..87edf6f0a4 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -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;