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]

Relative paths in startfile_prefix_spec


This patch makes the special handling of standard_startfile_prefix
available when using startfile_prefix_spec.  At the moment if someone
specifies STANDARD_STARTFILE_PREFIX in STARTFILE_PREFIX_SPEC, then
gcc hits the abort in add_sysrooted_prefix because the default
STANDARD_STARTFILE_PREFIX is "../../../" (ie. $unlibsubdir).

	* gcc.c (main): Move code for relative standard_startfile_prefix to..
	(add_sysrooted_prefix): ..here.

OK mainline?

Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.394
diff -u -p -r1.394 gcc.c
--- gcc/gcc.c	7 Oct 2003 21:14:14 -0000	1.394
+++ gcc/gcc.c	15 Oct 2003 03:13:09 -0000
@@ -2555,7 +2555,11 @@ add_prefix (struct path_prefix *pprefix,
   (*prev) = pl;
 }
 
-/* Same as add_prefix, but prepending target_system_root to prefix.  */
+/* Same as add_prefix, but prepending target_system_root to an absolute
+   PREFIX.  For native compilers, a relative PREFIX is based on
+   standard_exec_prefix and also on gcc_exec_prefix if that is defined.
+   For cross compilers, a relative PREFIX is ignored.  */ 
+
 static void
 add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
 		      const char *component,
@@ -2563,9 +2567,25 @@ add_sysrooted_prefix (struct path_prefix
 		      int require_machine_suffix, int *warn, int os_multilib)
 {
   if (!IS_ABSOLUTE_PATH (prefix))
-    abort ();
+    {
+      /* If prefix is relative, base it on standard_exec_prefix.  This
+	 lets us move the installed tree as a unit.  If GCC_EXEC_PREFIX
+	 is defined, base prefix on that as well.
 
-  if (target_system_root)
+         If the prefix is relative, only search it for native compilers;
+         otherwise we will search a directory containing host libraries.  */
+      if (*cross_compile != 0)
+	return;
+
+      if (gcc_exec_prefix)
+	add_prefix (pprefix,
+		    concat (gcc_exec_prefix, machine_suffix, prefix, NULL),
+		    component, priority,
+		    require_machine_suffix, warn, os_multilib);
+
+      prefix = concat (standard_exec_prefix, machine_suffix, prefix, NULL);
+    }
+  else if (target_system_root)
     {
       if (target_sysroot_suffix)
 	  prefix = concat (target_sysroot_suffix, prefix, NULL);
@@ -6103,30 +6123,9 @@ main (int argc, const char *const *argv)
 	add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix_1,
 			      "GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
 
-      /* If standard_startfile_prefix is relative, base it on
-	 standard_exec_prefix.  This lets us move the installed tree
-	 as a unit.  If GCC_EXEC_PREFIX is defined, base
-	 standard_startfile_prefix on that as well.
-
-         If the prefix is relative, only search it for native compilers;
-         otherwise we will search a directory containing host libraries.  */
-      if (IS_ABSOLUTE_PATH (standard_startfile_prefix))
-	add_sysrooted_prefix (&startfile_prefixes,
-			      standard_startfile_prefix, "BINUTILS",
-			      PREFIX_PRIORITY_LAST, 0, NULL, 1);
-      else if (*cross_compile == '0')
-	{
-	  if (gcc_exec_prefix)
-	    add_prefix (&startfile_prefixes,
-			concat (gcc_exec_prefix, machine_suffix,
-				standard_startfile_prefix, NULL),
-			NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
-	  add_prefix (&startfile_prefixes,
-		      concat (standard_exec_prefix,
-			      machine_suffix,
-			      standard_startfile_prefix, NULL),
-		      NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
-	}
+      add_sysrooted_prefix (&startfile_prefixes,
+			    standard_startfile_prefix, "BINUTILS",
+			    PREFIX_PRIORITY_LAST, 0, NULL, 1);
 
       add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1,
 			    "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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