public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] skipping of incompatible libraries in the search path
@ 1999-07-05  9:37 Jakub Jelinek
  1999-07-08 16:51 ` Richard Henderson
  1999-07-09 22:54 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 1999-07-05  9:37 UTC (permalink / raw)
  To: binutils

Hi!

This is a patch for how I think the skip on mismatch discussion ended.
It makes ld skip incompatible libraries unconditionally, but lets the user
know about it whenever it happens. If the user wants to force linking an
incompatible library in, he has to request it by supplying full path to the
library.

1999-07-05  Jakub Jelinek  <jj@ultra.linux.cz>

	* ld/ldfile.c (ldfile_open_file_search): Skip libraries made for
	incompatible architectures in the search path. Let the user know
	about any such skips.

--- ./ldfile.c.jj	Mon May  3 09:29:06 1999
+++ ./ldfile.c	Mon Jul  5 18:12:21 1999
@@ -177,8 +177,35 @@ ldfile_open_file_search (arch, entry, li
 
       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 (_("skipping %s because it has incompatible architecture\n"), string);
+	  bfd_close(entry->the_bfd);
+	  entry->the_bfd = NULL;
+	                                              
 	}
 
       free (string);


Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux  |  http://ultra.linux.cz/  |  http://ultra.penguin.cz/
Linux version 2.2.10 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-07-09 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-05  9:37 [PATCH] skipping of incompatible libraries in the search path Jakub Jelinek
1999-07-08 16:51 ` Richard Henderson
1999-07-09 22:54 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).