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]

Re: 3.3 PATCH: Add --with-sysroot support


On Tue, Nov 04, 2003 at 09:41:32PM +0100, Gabriel Dos Reis wrote:
> Daniel Jacobowitz <drow@mvista.com> writes:
> 
> | On Tue, Nov 04, 2003 at 12:44:02PM +0100, Gabriel Dos Reis wrote:
> | > "H. J. Lu" <hjl@lucon.org> writes:
> | > 
> | > | Since I need a stable compile with --with-sysroot support, I backported
> | > | it to gcc 3.3.
> | > 
> | > I understand you want sysroot support, but I don't see why we want or
> | > need that for 3.3.x.  Would you mind elaborating?
> | > (That is not an argumentative question).  
> | > I would need input from one of our build system maintainers. 
> | 
> | Actually, I think this would be a good idea.  Get people used to the
> | new way of building cross-compilers to hosted systems, sooner rather
> | than later - it's much simpler.  I was a bit disappointed by the
> | narrow distance we missed 3.3 by the first time.
> | 
> | I haven't looked at HJ's actual patch.  I have a complete sysroot
> | backport in my local 3.3 tree, though, so I can compare against that if
> | necessary.
> 
> Thanks a lot for the feedback.  HJ described his patch as a backport
> from 3.4. Since you have implemented a equivalent functionality in
> your local tree and understand the issue better than I, I would
> appreciate if you could have a look at HJ's patch and  comment further. 

Sorry about the wait.

HJ, I've attached the two patches from my local tree that appear to be
missing.  Otherwise it looks fine to me.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-07-16  Daniel Jacobowitz  <drow@mvista.com>

	* gcc.c (STANDARD_STARTFILE_PREFIX): Remove unnecessary definition.
	(main): Remove unnecessary case.  Only use standard_startfile_prefix
	if native.

--- gcc-3.3/gcc/gcc.c.orig	2003-07-16 10:43:15.000000000 -0400
+++ gcc-3.3/gcc/gcc.c	2003-07-16 10:45:59.000000000 -0400
@@ -1346,9 +1346,6 @@ static const char *gcc_exec_prefix;
 #ifndef STANDARD_EXEC_PREFIX
 #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
 #endif
-#ifndef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
-#endif
 #ifndef TOOLDIR_BASE_PREFIX
 #define TOOLDIR_BASE_PREFIX "/usr/local/"
 #endif
@@ -6165,15 +6162,10 @@ main (argc, 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 (IS_ABSOLUTE_PATHNAME (standard_startfile_prefix))
-	add_sysrooted_prefix (&startfile_prefixes,
-			      standard_startfile_prefix, "BINUTILS",
-			      PREFIX_PRIORITY_LAST, 0, NULL, 1);
-      else
+      /* Base standard_startfile_prefix (unlibsubdir) 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 (*cross_compile == '0')
 	{
 	  if (gcc_exec_prefix)
 	    add_prefix (&startfile_prefixes,




diff -urp gcc-3.3.1.hj/gcc/configure.in gcc-3.3.1.drow/gcc/configure.in
--- gcc-3.3.1.hj/gcc/configure.in	2003-11-06 15:35:07.000000000 -0500
+++ gcc-3.3.1.drow/gcc/configure.in	2003-11-06 15:34:23.000000000 -0500
@@ -181,7 +181,7 @@ AC_ARG_WITH(sysroot,
 [  --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
 [
  case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${gcc_tooldir}/sys-root' ;;
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
    
@@ -198,14 +198,15 @@ AC_ARG_WITH(sysroot,
   test_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
- ${test_prefix}*)
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"
    ;;
  esac
 ], [
  TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ TARGET_SYSTEM_ROOT_DEFINE=
  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
 ])
 AC_SUBST(TARGET_SYSTEM_ROOT)
@@ -2430,7 +2431,7 @@ case "$target" in
     ;;
 esac
 
-if test x$with_sysroot = x && x$host = x$target \
+if test x$with_sysroot = x && test x$host = x$target \
    && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
 fi
diff -urp gcc-3.3.1.hj/gcc/cppinit.c gcc-3.3.1.drow/gcc/cppinit.c
--- gcc-3.3.1.hj/gcc/cppinit.c	2003-11-06 15:35:02.000000000 -0500
+++ gcc-3.3.1.drow/gcc/cppinit.c	2003-11-06 15:34:23.000000000 -0500
@@ -793,8 +793,12 @@ init_standard_includes (pfile)
   /* Search "translated" versions of GNU directories.
      These have /usr/local/lib/gcc... replaced by specd_prefix.  */
   default_len = 0;
+  specd_len = 0;
+  default_prefix = NULL;
   if (specd_prefix != 0 && cpp_GCC_INCLUDE_DIR_len)
     {
+      /* Remove the `include' from /usr/local/lib/gcc.../include.
+	 GCC_INCLUDE_DIR will always end in /include.  */
       default_len = cpp_GCC_INCLUDE_DIR_len;
       default_prefix = (char *) alloca (default_len + 1);
       specd_len = strlen (specd_prefix);
@@ -803,7 +807,6 @@ init_standard_includes (pfile)
       default_prefix[default_len] = '\0';
     }
 
-  /* Search ordinary names for GNU include directories.  */
   for (p = cpp_include_defaults; p->fname; p++)
     {
       /* Some standard dirs are only for C++.  */
diff -urp gcc-3.3.1.hj/gcc/gcc.c gcc-3.3.1.drow/gcc/gcc.c
--- gcc-3.3.1.hj/gcc/gcc.c	2003-11-06 15:35:02.000000000 -0500
+++ gcc-3.3.1.drow/gcc/gcc.c	2003-11-06 15:36:17.000000000 -0500
@@ -200,7 +200,11 @@ static int report_times;
 /* Nonzero means place this string before uses of /, so that include
    and library files can be found in an alternate location.  */
 
+#ifdef TARGET_SYSTEM_ROOT
 static const char *target_system_root = TARGET_SYSTEM_ROOT;
+#else
+static const char *target_system_root = 0;
+#endif
 
 /* Nonzero means pass the updated target_system_root to the compiler.  */
 


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