This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bugs in sysroot patches resulting in $(local_include)/include always searched, ../-expansion broken
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 Feb 2003 14:09:13 -0500
- Subject: Re: Bugs in sysroot patches resulting in $(local_include)/include always searched, ../-expansion broken
- References: <200302201509.h1KF9fMM008092@ignucius.axis.se>
On Thu, Feb 20, 2003 at 04:09:41PM +0100, Hans-Peter Nilsson wrote:
> (Hmm, gcc-bugs or gcc-patches? Better avoid both. It's
> "discussion of particular patches" with expected follow-up
> discussion even more, so let's go with that.)
>
> First of all, thanks for the sysroot stuff. However, my
> non-sysrooted cross cris-axis-linux-gnu test-setup broke between
> Feb 12 and Feb 16, and I suspect these changes. I use
> --prefix=/home/hp/work/axis/build/gcc3testprefix and some
> symlinks at that prefix pointing to another place. Not really
> the normal case, but it works (worked) for testing purposes.
>
> I spot /usr/local/include in the default search list (-v). I
> think it's due to this bug:
>
> cppdefault.h:
> #if defined (CROSS_COMPILE) && !defined (TARGET_SYSTEM_ROOT)
> # undef LOCAL_INCLUDE_DIR
> # undef SYSTEM_INCLUDE_DIR
> # undef STANDARD_INCLUDE_DIR
> #else
> # undef CROSS_INCLUDE_DIR
> #endif
>
> configure.in:497:
> TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
> configure.in:521:
> TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
>
> That is, TARGET_SYSTEM_ROOT is always defined, to 0 in the
> unused case, so the #if defined-test always yields true. I see
> no other macro that can be tested as a trivially replacement so
> I leave the fix to you.
For this problem, could you try out the following patch?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-02-20 Daniel Jacobowitz <drow at mvista dot com>
* configure.in: Don't always define TARGET_SYSTEM_ROOT.
* configure: Regenerated.
* gcc.c: Check whether TARGET_SYSTEM_ROOT is defined.
Index: configure
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/configure,v
retrieving revision 1.658
diff -u -p -r1.658 configure
--- configure 14 Feb 2003 17:28:54 -0000 1.658
+++ configure 20 Feb 2003 19:06:54 -0000
@@ -2299,7 +2299,7 @@ if test "${with_sysroot+set}" = set; the
else
TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ TARGET_SYSTEM_ROOT_DEFINE=
CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
fi
Index: configure.in
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/configure.in,v
retrieving revision 1.643
diff -u -p -r1.643 configure.in
--- configure.in 14 Feb 2003 17:28:55 -0000 1.643
+++ configure.in 20 Feb 2003 19:05:31 -0000
@@ -514,7 +514,7 @@ AC_ARG_WITH(sysroot,
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)
Index: gcc.c
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/gcc.c,v
retrieving revision 1.362
diff -u -p -r1.362 gcc.c
--- gcc.c 18 Feb 2003 18:19:09 -0000 1.362
+++ gcc.c 20 Feb 2003 19:06:18 -0000
@@ -202,7 +202,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. */