summaryrefslogtreecommitdiff
path: root/packages/gcc/gcc-3.4.4
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2008-07-25 01:12:06 +0000
committerKhem Raj <raj.khem@gmail.com>2008-07-25 01:12:06 +0000
commite96e82cd7ee95d712e2c68f2f9540bdfe727645b (patch)
tree39cdeb09343849bef85eba68c048b9f3b670ac9b /packages/gcc/gcc-3.4.4
parenta3e73146adce111fe67af0886a43acbf7a654bd7 (diff)
Change the toolchain build sequence. Helps in reproducable toolchains components when recompiled. Also same sequence for all different combinations (uclibc/nptl/eglibc/glibc/linuxthreads). Also fixes and patches that I worked to get various ancient compilers working.
Diffstat (limited to 'packages/gcc/gcc-3.4.4')
-rw-r--r--packages/gcc/gcc-3.4.4/gcc-cross-fixincl.patch77
-rw-r--r--packages/gcc/gcc-3.4.4/gcc-libgcc2-inhibit-libc.patch251
2 files changed, 328 insertions, 0 deletions
diff --git a/packages/gcc/gcc-3.4.4/gcc-cross-fixincl.patch b/packages/gcc/gcc-3.4.4/gcc-cross-fixincl.patch
new file mode 100644
index 0000000000..365485497c
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc-cross-fixincl.patch
@@ -0,0 +1,77 @@
+See http://gcc.gnu.org/PR22541
+
+From: Dan Kegel
+
+When building gcc-3.4.3 or gcc-4.0.0 as a cross 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.)
+
+
+---
+ gcc/Makefile.in | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+Index: gcc-3.4.4/gcc/Makefile.in
+===================================================================
+--- gcc-3.4.4.orig/gcc/Makefile.in 2008-07-23 23:44:15.000000000 -0700
++++ gcc-3.4.4/gcc/Makefile.in 2008-07-23 23:46:54.000000000 -0700
+@@ -350,7 +350,10 @@ NATIVE_SYSTEM_HEADER_DIR = /usr/include
+ 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@
+@@ -2548,11 +2551,14 @@ install-gcc-tooldir:
+ $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir)
+
+ # 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: fixinc.sh gsyslimits.h
+ @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
diff --git a/packages/gcc/gcc-3.4.4/gcc-libgcc2-inhibit-libc.patch b/packages/gcc/gcc-3.4.4/gcc-libgcc2-inhibit-libc.patch
new file mode 100644
index 0000000000..4e2b5667ff
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc-libgcc2-inhibit-libc.patch
@@ -0,0 +1,251 @@
+---
+ gcc/Makefile.in | 25 ++++++++++++++++---------
+ gcc/configure | 22 ++++++++++++++++++----
+ gcc/configure.ac | 15 ++++++++++++---
+ gcc/gcc.c | 9 +++++++++
+ 4 files changed, 55 insertions(+), 16 deletions(-)
+
+Index: gcc-3.4.4/gcc/configure.ac
+===================================================================
+--- gcc-3.4.4.orig/gcc/configure.ac 2008-07-23 23:53:04.000000000 -0700
++++ gcc-3.4.4/gcc/configure.ac 2008-07-23 23:53:05.000000000 -0700
+@@ -567,6 +567,10 @@ AC_ARG_ENABLE(shared,
+ ], [enable_shared=yes])
+ AC_SUBST(enable_shared)
+
++AC_ARG_WITH(build-sysroot,
++ [ --with-build-sysroot=sysroot
++ use sysroot as the system root during the build])
++
+ AC_ARG_WITH(sysroot,
+ [ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
+ [
+@@ -577,6 +581,11 @@ AC_ARG_WITH(sysroot,
+
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
++ if test "x$with_build_sysroot" != x; then
++ build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
++ else
++ build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
++ fi
+
+ if test "x$exec_prefix" = xNONE; then
+ if test "x$prefix" = xNONE; then
+@@ -1453,7 +1462,7 @@ if test x$host != x$target
+ then
+ CROSS="-DCROSS_COMPILE"
+ ALL=all.cross
+- SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
++ SYSTEM_HEADER_DIR=$build_system_header_dir
+ case "$host","$target" in
+ # Darwin crosses can use the host system's libraries and headers,
+ # because of the fat library support. Of course, it must be the
+@@ -1487,11 +1496,11 @@ fi
+ # then define inhibit_libc in LIBGCC2_CFLAGS.
+ # This prevents libgcc2 from containing any code which requires libc
+ # support.
+-inhibit_libc=
++inhibit_libc=false
+ if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
+ test x$with_newlib = xyes ; } &&
+ { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
+- inhibit_libc=-Dinhibit_libc
++ inhibit_libc=true
+ fi
+ AC_SUBST(inhibit_libc)
+
+Index: gcc-3.4.4/gcc/Makefile.in
+===================================================================
+--- gcc-3.4.4.orig/gcc/Makefile.in 2005-02-24 01:26:57.000000000 -0800
++++ gcc-3.4.4/gcc/Makefile.in 2008-07-24 00:08:18.000000000 -0700
+@@ -291,7 +291,7 @@ GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./x
+ # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
+ # It omits XCFLAGS, and specifies -B./.
+ # It also specifies -isystem ./include to find, e.g., stddef.h.
+-GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
++GCC_CFLAGS=$(CFLAGS_FOR_TARGET) $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
+
+ # ---------------------------------------------------
+ # Programs which produce files for the target machine
+@@ -485,10 +485,17 @@ GGC_LIB=
+ LIBGCC = libgcc.a
+ INSTALL_LIBGCC = install-libgcc
+
++# "true" if the target C library headers are unavailable; "false"
++# otherwise.
++inhibit_libc = @inhibit_libc@
++ifeq ($(inhibit_libc),true)
++INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
++endif
++
+ # Options to use when compiling libgcc2.a.
+ #
+ LIBGCC2_DEBUG_CFLAGS = -g
+-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
++LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED $(INHIBIT_LIBC_CFLAGS)
+
+ # Additional options to use when compiling libgcc2.a.
+ # Some targets override this to -isystem include
+@@ -500,7 +507,7 @@ TARGET_LIBGCC2_CFLAGS =
+ # Options to use when compiling crtbegin/end.
+ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
+ -finhibit-size-directive -fno-inline-functions -fno-exceptions \
+- -fno-zero-initialized-in-bss -fno-unit-at-a-time
++ -fno-zero-initialized-in-bss -fno-unit-at-a-time $(INHIBIT_LIBC_CFLAGS)
+
+ # Additional sources to handle exceptions; overridden by targets as needed.
+ LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
+@@ -1247,33 +1254,33 @@ stmp-multilib: $(LIBGCC_DEPS)
+ $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+- @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
+ -o $(T)crtbegin$(objext)
+
+ $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+- @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END \
++ -c $(srcdir)/crtstuff.c -DCRT_END \
+ -o $(T)crtend$(objext)
+
+ # These are versions of crtbegin and crtend for shared libraries.
+ $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
+- @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
+ -o $(T)crtbeginS$(objext)
+
+ $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
+- @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
++ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
+ -o $(T)crtendS$(objext)
+
+ # This is a version of crtbegin for -static links.
+ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+- @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
+ -o $(T)crtbeginT$(objext)
+
+ # Compile the start modules crt0.o and mcrt0.o that are linked with
+@@ -2542,7 +2549,7 @@ install-gcc-tooldir:
+
+ # Build fixed copies of system files.
+ stmp-fixinc: fixinc.sh gsyslimits.h
+- @if test ! -d ${SYSTEM_HEADER_DIR}; then \
++ @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"; \
+Index: gcc-3.4.4/gcc/gcc.c
+===================================================================
+--- gcc-3.4.4.orig/gcc/gcc.c 2005-05-01 03:33:14.000000000 -0700
++++ gcc-3.4.4/gcc/gcc.c 2008-07-23 23:53:05.000000000 -0700
+@@ -1069,6 +1069,7 @@ static const struct option_map option_ma
+ {"--static", "-static", 0},
+ {"--std", "-std=", "aj"},
+ {"--symbolic", "-symbolic", 0},
++ {"--sysroot", "--sysroot=", "aj"},
+ {"--time", "-time", 0},
+ {"--trace-includes", "-H", 0},
+ {"--traditional", "-traditional", 0},
+@@ -3016,6 +3017,9 @@ display_help (void)
+ fputs (_(" -time Time the execution of each subprocess\n"), stdout);
+ fputs (_(" -specs=<file> Override built-in specs with the contents of <file>\n"), stdout);
+ fputs (_(" -std=<standard> Assume that the input sources are for <standard>\n"), stdout);
++ fputs (_("\
++ --sysroot=<directory> Use <directory> as the root directory for headers\n\
++ for headers and libraries\n"), stdout);
+ fputs (_(" -B <directory> Add <directory> to the compiler's search paths\n"), stdout);
+ fputs (_(" -b <machine> Run gcc for target <machine>, if installed\n"), stdout);
+ fputs (_(" -V <version> Run gcc version number <version>, if installed\n"), stdout);
+@@ -3884,6 +3888,11 @@ warranty; not even for MERCHANTABILITY o
+ ;
+ else if (! strcmp (argv[i], "-fhelp"))
+ ;
++ else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
++ {
++ target_system_root = argv[i] + strlen ("--sysroot=");
++ target_system_root_changed = 1;
++ }
+ else if (argv[i][0] == '+' && argv[i][1] == 'e')
+ {
+ /* Compensate for the +e options to the C++ front-end;
+Index: gcc-3.4.4/gcc/configure
+===================================================================
+--- gcc-3.4.4.orig/gcc/configure 2008-07-23 23:53:04.000000000 -0700
++++ gcc-3.4.4/gcc/configure 2008-07-23 23:53:05.000000000 -0700
+@@ -907,6 +907,8 @@ Optional Packages:
+ --with-as arrange to use the specified as (full pathname)
+ --with-stabs arrange to use stabs instead of host debug format
+ --with-dwarf2 force the default debug format to be DWARF 2
++ --with-build-sysroot=sysroot
++ use sysroot as the system root during the build
+ --with-sysroot=DIR Search for usr/lib, usr/include, et al, within DIR.
+ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib
+ --with-system-libunwind use installed libunwind
+@@ -4756,6 +4758,13 @@ fi;
+
+
+
++# Check whether --with-build-sysroot or --without-build-sysroot was given.
++if test "${with_build_sysroot+set}" = set; then
++ withval="$with_build_sysroot"
++
++fi;
++
++
+ # Check whether --with-sysroot or --without-sysroot was given.
+ if test "${with_sysroot+set}" = set; then
+ withval="$with_sysroot"
+@@ -4767,6 +4776,11 @@ if test "${with_sysroot+set}" = set; the
+
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
++ if test "x$with_build_sysroot" != x; then
++ build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
++ else
++ build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
++ fi
+
+ if test "x$exec_prefix" = xNONE; then
+ if test "x$prefix" = xNONE; then
+@@ -5229,7 +5243,7 @@ if test "${gcc_cv_prog_makeinfo_modern+s
+ else
+ ac_prog_version=`$MAKEINFO --version 2>&1 |
+ sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+- echo "configure:5232: version of makeinfo is $ac_prog_version" >&5
++ echo "configure:5246: version of makeinfo is $ac_prog_version" >&5
+ case $ac_prog_version in
+ '') gcc_cv_prog_makeinfo_modern=no;;
+ 4.[2-9]*)
+@@ -9845,7 +9859,7 @@ if test x$host != x$target
+ then
+ CROSS="-DCROSS_COMPILE"
+ ALL=all.cross
+- SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
++ SYSTEM_HEADER_DIR=$build_system_header_dir
+ case "$host","$target" in
+ # Darwin crosses can use the host system's libraries and headers,
+ # because of the fat library support. Of course, it must be the
+@@ -9879,11 +9893,11 @@ fi
+ # then define inhibit_libc in LIBGCC2_CFLAGS.
+ # This prevents libgcc2 from containing any code which requires libc
+ # support.
+-inhibit_libc=
++inhibit_libc=false
+ if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
+ test x$with_newlib = xyes ; } &&
+ { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
+- inhibit_libc=-Dinhibit_libc
++ inhibit_libc=true
+ fi
+
+