summaryrefslogtreecommitdiff
path: root/ld/ldfile.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-07-08 16:50:53 +0000
committerRichard Henderson <rth@redhat.com>1999-07-08 16:50:53 +0000
commit99f8f232c6b14a5842615b9ef0e824eb58f6f717 (patch)
treee6d0dc8c081f57f173fdcd57654301f5b562794d /ld/ldfile.c
parent9df31319e84a3cb3999930a846f8a98e66bc1632 (diff)
downloadbinutils-gdb-99f8f232c6b14a5842615b9ef0e824eb58f6f717.tar.gz
Jakub Jelinek <jj@ultra.linux.cz>
* ldfile.c (ldfile_open_file_search): Skip libraries made for incompatible architectures in the search path. Let the user know about any such skips.
Diffstat (limited to 'ld/ldfile.c')
-rw-r--r--ld/ldfile.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 1dfa31f2192..7946dda818a 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -177,8 +177,35 @@ ldfile_open_file_search (arch, entry, lib, suffix)
if (ldfile_try_open_bfd (string, entry))
{
- entry->filename = string;
- return true;
+ bfd * arfile = NULL;
+
+ if (bfd_check_format (entry->the_bfd, bfd_archive))
+ {
+ /* We treat an archive as compatible if it empty
+ or has at least one compatible object. */
+ arfile = bfd_openr_next_archived_file (entry->the_bfd, NULL);
+
+ if (!arfile)
+ arfile = output_bfd;
+ else
+ while (arfile
+ && !(bfd_check_format (arfile, bfd_object)
+ && bfd_arch_get_compatible (arfile, output_bfd)))
+ arfile = bfd_openr_next_archived_file (entry->the_bfd, arfile);
+ }
+ else if (bfd_arch_get_compatible (entry->the_bfd, output_bfd))
+ arfile = output_bfd;
+
+ if (arfile)
+ {
+ entry->filename = string;
+ return true;
+ }
+
+ info_msg (_("%s is for an incompatible architecture -- skipped\n"),
+ string);
+ bfd_close(entry->the_bfd);
+ entry->the_bfd = NULL;
}
free (string);