This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[csl-arm] Backport as-needed patch.
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: Daniel Jacobowitz <dan at codesourcery dot com>
- Date: Wed, 13 Apr 2005 15:58:37 +0100
- Subject: [csl-arm] Backport as-needed patch.
- Organization: CodeSourcery
I've backported the attached patch from mainline to
binutils-csl-arm-2005q1-branch.
Paul
2005-04-13 Paul Brook <paul@codesourcery.com>
Backport from mainline.
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.
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /var/cvsroot/src-cvs/src/ld/emultempl/elf32.em,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -p -r1.138 -r1.139
--- ld/emultempl/elf32.em 4 Apr 2005 11:27:15 -0000 1.138
+++ ld/emultempl/elf32.em 11 Apr 2005 14:26:46 -0000 1.139
@@ -230,6 +230,9 @@ gld${EMULATION_NAME}_stat_needed (lang_i
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_
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;