From 99f8f232c6b14a5842615b9ef0e824eb58f6f717 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 8 Jul 1999 16:50:53 +0000 Subject: Jakub Jelinek * ldfile.c (ldfile_open_file_search): Skip libraries made for incompatible architectures in the search path. Let the user know about any such skips. --- ld/ChangeLog | 6 ++++++ ld/ldfile.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index a964c22..3f3d8d6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +1999-07-08 Jakub Jelinek + + * ldfile.c (ldfile_open_file_search): Skip libraries made for + incompatible architectures in the search path. Let the user know + about any such skips. + Thu Jul 8 12:32:23 1999 John David Anglin * configure.tgt (hppa*-linux-gnu*): New target. diff --git a/ld/ldfile.c b/ld/ldfile.c index 1dfa31f..7946dda 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); -- cgit v1.1