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]

improve biarch powerpc64-linux support


This is aimed at supporting biarch compilers when someone configures
--host=powerpc-linux --target=powerpc64-linux (or defaults --host).
ie. We're really native and would like /usr/lib, /lib, /usr/lib64, and
/lib64 to be searched for startup and library files.

	* gcc.c (main): Move code for relative standard_startfile_prefix to..
	(add_sysrooted_prefix): ..here.  Enable relative prefix for
	startfile_prefix_spec.
	* config/rs6000/linux64.h (STARTFILE_PREFIX_SPEC): Define.

Bootstrapped etc. powerpc-linux, powerpc64-linux.  OK mainline?

Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.405
diff -u -p -r1.405 gcc.c
--- gcc/gcc.c	24 Jan 2004 10:09:48 -0000	1.405
+++ gcc/gcc.c	7 Feb 2004 12:11:16 -0000
@@ -2559,7 +2559,10 @@ 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,
@@ -2567,9 +2570,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 the prefix is relative, only search it for native compilers;
+	 otherwise we will search a directory containing host libraries.  */
+      if (*cross_compile != '0' && *startfile_prefix_spec == 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);
 
-  if (target_system_root)
+      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);
@@ -6114,31 +6133,8 @@ 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);
       add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2,
Index: gcc/config/rs6000/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linux64.h,v
retrieving revision 1.57
diff -u -p -r1.57 linux64.h
--- gcc/config/rs6000/linux64.h	3 Feb 2004 00:40:26 -0000	1.57
+++ gcc/config/rs6000/linux64.h	7 Feb 2004 12:11:18 -0000
@@ -327,6 +327,12 @@
 #undef  LIB_DEFAULT_SPEC
 #define LIB_DEFAULT_SPEC "%(lib_linux)"
 
+#if defined (CROSS_COMPILE) && defined (NATIVE_CROSS)
+/* Really native, look in standard places.  The multilib support will
+   add ../lib64/ as needed.  */
+#define STARTFILE_PREFIX_SPEC STANDARD_STARTFILE_PREFIX " /lib/ /usr/lib/"
+#endif
+
 #undef  STARTFILE_DEFAULT_SPEC
 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
 

-- 
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]