This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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] gcc-4.2-20051201


  patch to add patches/gcc-4.2-20051201/ directory if anyone wants to
play with the latest gcc snapshot.  let me know if i messed anything
up.  the two patches being brought forward (and rediffed for
cleanliness) are the ubiquitous fixincl patch, plus one specific to
the SH architecture.

rday

--- crosstool-0.38.orig/patches/gcc-4.2-20051201/fix-fixincl.patch	1969-12-31 19:00:00.000000000 -0500
+++ crosstool-0.38/patches/gcc-4.2-20051201/fix-fixincl.patch		2005-12-02 13:50:17.000000000 -0500
@@ -0,0 +1,72 @@
+From: Dan Kegel
+
+When building gcc-3.4.3 or gcc-4.0.[01] into a clean $PREFIX (the only two I've tried like this),
+the configure script happily copies the glibc include files from include to sys-include;
+here's the line from the log file (with $PREFIX instead of the real prefix):
+
+Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include
+
+But later, when running fixincludes, it gives the error message
+ The directory that should contain system headers does not exist:
+  $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include
+
+Nevertheless, it continues building; the header files it installs in
+ $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include
+do not include the boilerplate that would cause it to #include_next the
+glibc headers in the system header directory.
+Thus the resulting toolchain can't compile the following program:
+#include <limits.h>
+int x = PATH_MAX;
+because its limits.h doesn't include the glibc header.
+
+That's not nice.  I suspect the problem is that gcc/Makefile.in assumes that
+it can refer to $PREFIX/i686-unknown-linux-gnu  with the path
+                $PREFIX/lib/../i686-unknown-linux-gnu, but
+that fails because the directory $PREFIX/lib doesn't exist during 'make all';
+it is only created later, during 'make install'.  (Which makes this problem
+confusing, since one only notices the breakage well after 'make install',
+at which point the path configure complained about does exist, and has the
+right stuff in it.)
+
+A possible fix is to replace the line in gcc/Makefile.in that says
+    SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
+with a version that gets rid of extra ..'s, e.g.
+    SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"`
+(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq
+for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.)
+
+[Rediffed against gcc-4.2-20051201, Dec 2, 2005.]
+
+--- gcc-4.2-20051201.orig/gcc/Makefile.in	2005-04-04 12:45:13.000000000 -0700
++++ gcc-4.2-20051201/gcc/Makefile.in		2005-05-20 12:33:43.000000000 -0700
+@@ -388,7 +388,10 @@
+ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
++# Purge it of unneccessary internal relative paths
++# to directories that might not exist yet.
++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
+
+ # Control whether to run fixproto and fixincludes.
+ STMP_FIXPROTO = @STMP_FIXPROTO@
+@@ -3166,13 +3166,15 @@
+ ../$(build_subdir)/fixincludes/fixincl: ; @ :
+
+ # Build fixed copies of system files.
++# Abort if no system headers available, unless building a crosscompiler.
++# FIXME: abort unless building --without-headers would be more accurate and less ugly
+ stmp-fixinc: gsyslimits.h macro_list \
+   $(build_objdir)/fixincludes/fixincl \
+   $(build_objdir)/fixincludes/fixinc.sh
+ 	@if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
+ 	  echo The directory that should contain system headers does not exist: >&2 ; \
+ 	  echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
+-	  if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
++	  if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \
+	  then sleep 1; else exit 1; fi; \
+	fi
+	rm -rf include; mkdir include
+
+Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
--- crosstool-0.38.orig/patches/gcc-4.2-20051201/pr24836-fix.patch	1969-12-31 19:00:00.000000000 -0500
+++ crosstool-0.38/patches/gcc-4.2-20051201/pr24836-fix.patch		2005-12-02 13:50:17.000000000 -0500
@@ -0,0 +1,22 @@
+PR:  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
+
+  The most recent versions of gcc don't take into account building for
+big-endian SH architectures.  It's quite likely this case pattern should
+be extended to handle even more SH variations but, for now, this is
+minimally what should be recognized.
+
+[Rediffed against gcc-4.2-20051201, Dec 2, 2005.]
+
+--- gcc.old/gcc/configure	2005-11-14 13:15:15.000000000 -0500
++++ gcc/gcc/configure		2005-08-23 22:24:14.000000000 -0400
+@@ -14740,7 +14740,7 @@
+ 	tls_first_minor=14
+ 	tls_as_opt="-m64 -Aesame --fatal-warnings"
+ 	;;
+-  sh-*-* | sh[34]-*-*)
++  sh-*-* | sh[34]-*-* | sh[34]eb-*-*)
+     conftest_s='
+ 	.section ".tdata","awT",@progbits
+ foo:	.long	25
+
+Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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