This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to pass fewer -L multilib arguments


This patch reduces the number of -L paths the driver passes to the
linker (for example, avoiding passing inappropriate multilib paths),
as explained by Mark in
<http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01170.html>.

Bootstrapped with no regressions on i386-pc-solaris2.10.  OK to
commit?

2004-11-23  Mark Mitchell  <mark@codesourcery.com>

	* gcc.c (do_spec_1): Do not add a -L path for a directory in
	the prefix list if we have already added a multilib directory
	based on that path.
	(main): Do not add MD_EXEC_PREFIX to the list of directories to
	search with -L.

diff -rupN -x CVS gcc-merge-HEAD-csl-sol210-1/gcc/gcc.c gcc-sol210/gcc/gcc.c
--- gcc-merge-HEAD-csl-sol210-1/gcc/gcc.c	2004-09-18 12:47:09.000000000 -0700
+++ gcc-sol210/gcc/gcc.c	2004-10-12 23:29:02.000000000 -0700
@@ -4387,6 +4387,7 @@ do_spec_path (struct prefix_list *pl, co
   static size_t bufsize = 0;
   static char *buffer;
   int idx;
+  bool multilib_p = false;
 
   /* Used on systems which record the specified -L dirs
      and use them to search for dynamic linking.  */
@@ -4409,6 +4410,7 @@ do_spec_path (struct prefix_list *pl, co
       strcat (buffer, machine_suffix);
       if (is_directory (buffer, dir_for_machine_suffix, 1))
 	{
+	  multilib_p = true;
 	  do_spec_1 (option, separate_options, NULL);
 	  if (separate_options)
 	    do_spec_1 (" ", 0, NULL);
@@ -4422,6 +4424,7 @@ do_spec_path (struct prefix_list *pl, co
     {
       if (is_directory (pl->prefix, dir_for_no_suffix, 1))
 	{
+	  multilib_p = true;
 	  do_spec_1 (option, separate_options, NULL);
 	  if (separate_options)
 	    do_spec_1 (" ", 0, NULL);
@@ -4432,7 +4435,7 @@ do_spec_path (struct prefix_list *pl, co
 	}
     }
 
-  if (only_subdir)
+  if (only_subdir || multilib_p)
     return;
 
   if (machine_suffix)
@@ -6195,10 +6198,6 @@ main (int argc, const char **argv)
      startfile_prefix_spec exclusively.  */
   else if (*cross_compile == '0' || target_system_root)
     {
-      if (*md_exec_prefix)
-	add_sysrooted_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
-			      PREFIX_PRIORITY_LAST, 0, 1);
-
       if (*md_startfile_prefix)
 	add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix,
 			      "GCC", PREFIX_PRIORITY_LAST, 0, 1);

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]