From 23c2ba7ebfcf694d05c367c38276e3335433939f Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Wed, 13 Apr 2005 14:58:17 +0000 Subject: [PATCH] 2005-04-13 Paul Brook Backport from mainline. 2005-04-11 Alan Modra * emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Ignore as_needed libs that were not needed. (gld${EMULATION_NAME}_check_needed): Likewise. --- ChangeLog.csl | 8 ++++++++ ld/emultempl/elf32.em | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog.csl b/ChangeLog.csl index 4b8c9f3..a82b8ce 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,11 @@ +2005-04-13 Paul Brook + + Backport from mainline. + 2005-04-11 Alan Modra + * emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Ignore + as_needed libs that were not needed. + (gld${EMULATION_NAME}_check_needed): Likewise. + 2005-04-08 Mark Mitchell * ld/configure.tgt (arm-wrs-linux-gnueabi*): Support both big- and diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 8bdf88d..a5e6739 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -226,6 +226,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) { @@ -733,6 +736,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; -- 2.7.4