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]

gcc 4.2.2 and glibc 2.7 patches


I have attached patches for the changes that I had to make to use crosstool to build gcc 4.2.2, glibc 2.7, and binutils 2.18 with nptl and tls for mips running a 2.6.23.9 Linux kernel.
The patches to the glibc make files are taken from patches that others had made for older versions. One of them includes a URL reference. I did not document the other two.


My changes to crosstool.sh are kludges made specifically for my build. I am including it so that you know what I had to do and the problems that I faced with crosstool itself.

NB: The port of Linux for my target mips board is suffering from a bad case of bit rot, which means that I have not been able to verify that the resulting tools can build a working system for mips.

I hope that somebody will find these changes to be useful.

If you have any questions, please write back to me directly as I will soon be hopping off this list.
--- crosstool-0.43/crosstool.sh	2008-01-14 09:50:28.000000000 -0500
+++ /tmp/crosstool.sh	2008-01-14 09:49:53.000000000 -0500
@@ -74,13 +74,19 @@
    # this is lame, need to fix this for nptl later?
    # (nptl is an addon, but it's shipped in the main tarball)
    GLIBC_ADDON_OPTIONS="="
-   case "${GLIBCTHREADS_FILENAME}" in
-     *linuxthreads*) GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}linuxthreads," ;;
-   esac
+# GW want nptl instead
+#   case "${GLIBCTHREADS_FILENAME}" in
+#     *linuxthreads*) GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}linuxthreads," ;;
+#   esac
    # crypt is only an addon for glibc-2.1.x
    test -z "${GLIBCCRYPT_FILENAME}"   || GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}crypt,"
 fi
 
+# GW need separate ports code for mips et al now
+GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS},glibc-ports-2.7,"
+# GW use nptl instead of old linuxthreads
+GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS},nptl,"
+
 # Add some default glibc config options if not given by user.  These used to be hardcoded.
 DEFAULT_GLIBC_EXTRA_CONFIG=""
 case "${GLIBC_EXTRA_CONFIG}" in
@@ -100,8 +106,9 @@
 test -z "${LD_LIBRARY_PATH}" || abort  "glibc refuses to build if LD_LIBRARY_PATH is set.  Please unset it before running this script."
 
 # And one is derived if unset.
-test -z "${GLIBCTHREADS_FILENAME}" &&
-GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'`
+# GW using nptl instead
+#test -z "${GLIBCTHREADS_FILENAME}" &&
+#GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'`
 
 # Check for a few prerequisites that have tripped people up.
 awk '/x/' < /dev/null  || abort "You need awk to build a toolchain."
@@ -200,10 +207,16 @@
 # to decide that since build==host, they could run host binaries.
 #
 # if host is cygwin and this is not a canadian build, modify GCC_HOST
-case "$GCC_HOST,$CANADIAN_BUILD," in
-*cygwin*,?*,) ;;
-*)            GCC_HOST=`echo $GCC_HOST | sed s/-/-host_/` ;;
-esac
+
+# GW this -host_ thing prevents building on Xubuntu 7.04. Although I am running a P4
+# and this script auto detects i686, the actual build tools are prefixed with i486, 
+# so I had to specify the i486 prefix in the dat file.
+# For the interested: I also had to make links to unprefixed tools like ar because 
+# only some tools like gcc have prefixes in Xubuntu 7.04.
+#case "$GCC_HOST,$CANADIAN_BUILD," in
+#*cygwin*,?*,) ;;
+#*)            GCC_HOST=`echo $GCC_HOST | sed s/-/-host_/` ;;
+#esac
 
 
 # If we're building compilers that run on Windows, remember that their
@@ -400,6 +413,13 @@
 if grep -q 'gcc-[34]' ${GCC_CORE_DIR}/ChangeLog && test '!' -f $HEADERDIR/features.h; then
     mkdir -p build-glibc-headers; cd build-glibc-headers
 
+# GW patch for stdio_lim.h
+cp ${TOP_DIR}/Makefile.glibc-2.7.stdio-common ../glibc-2.7/stdio-common/Makefile
+
+# GW -mabi=32 error from cc1
+# http://sourceware.org/ml/crossgcc/2005-07/msg00036.html
+cp ${TOP_DIR}/Makefile.glibc-2.7.glibc-ports-2.7 ../glibc-2.7/glibc-ports-2.7/sysdeps/mips/mips32/Makefile
+
     if test '!' -f Makefile; then
         # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
         # 1. override CC to keep glibc's configure from using $TARGET-gcc. 
@@ -440,9 +460,17 @@
         touch stdio-common/errlist-compat.c
     fi
     # Note: BOOTSTRAP_GCC is used by patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
+
+# GW lib-names.h did not exist for mipsel early in my build attempts.
+MADNESS=/home/gregor/sx/cross_build/crosstool-0.43/build/mipsel-linux-gnu/gcc-4.2.2-glibc-2.7
+mkdir ${MADNESS}/build-glibc-headers/gnu
+cp ${MADNESS}/glibc-2.7/glibc-ports-2.7/sysdeps/unix/sysv/aix/gnu/lib-names.h \
+	${MADNESS}/build-glibc-headers/gnu/lib-names.h
+
     libc_cv_ppc_machine=yes \
     make cross-compiling=yes install_root=${SYSROOT} CFLAGS=-DBOOTSTRAP_GCC $GLIBC_SYSROOT_ARG install-headers
 
+
     # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
     # so do them by hand.  We can tolerate an empty stubs.h for the moment.
     # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
@@ -453,6 +481,7 @@
     # Building the bootstrap gcc requires either setting inhibit_libc, or
     # having a copy of stdio_lim.h... see
     # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
+# GW still need copy kludge?
     cp bits/stdio_lim.h $HEADERDIR/bits/stdio_lim.h
 
     # Following error building gcc-4.0.0's gcj:
@@ -506,6 +535,9 @@
 
 mkdir -p build-glibc; cd build-glibc
 
+# GW my version of glibc-2.7 Makerules
+cp ${TOP_DIR}/Makerules.glibc-2.7 ../glibc-2.7/Makerules
+
 # sh4 really needs to set configparms as of gcc-3.4/glibc-2.3.2
 # note: this is awkward, doesn't work well if you need more than one line in configparms
 echo ${GLIBC_CONFIGPARMS} > configparms
@@ -560,6 +592,7 @@
 # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
 # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
 # No need for PARALLELMFLAGS here, Makefile already reads this environment variable
+
 make LD=${TARGET}-ld RANLIB=${TARGET}-ranlib $GLIBC_INITIAL_BUILD_RULE
 make install_root=${SYSROOT} $GLIBC_SYSROOT_ARG $GLIBC_INITIAL_INSTALL_RULE
 

Attachment: gcc-4.2.2-glibc-2.7-tls.dat
Description: MOPAC data

--- glibc-2.7/glibc-ports-2.7/sysdeps/mips/mips32/Makefile	2003-03-29 03:15:28.000000000 -0500
+++ Makefile.glibc-2.7.glibc-ports-2.7	2008-01-14 09:17:47.000000000 -0500
@@ -1,3 +1,8 @@
+# http://sourceware.org/ml/crossgcc/2005-07/msg00036.html
+ifeq ($(filter -DBOOTSTRAP_GCC,$(CFLAGS)),)
 ifeq ($(filter -mabi=32,$(CC)),)
 CC += -mabi=32
 endif
+else
+CC += -D"_MIPS_SZPTR=32"
+endif
--- glibc-2.7/stdio-common/Makefile	2007-09-18 14:54:24.000000000 -0400
+++ Makefile.glibc-2.7.stdio-common	2008-01-14 09:17:47.000000000 -0500
@@ -21,7 +21,7 @@
 #
 subdir	:= stdio-common
 
-headers	:= stdio_ext.h printf.h bits/printf-ldbl.h
+headers	:= stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
 
 routines	:=							      \
 	ctermid cuserid							      \
@@ -38,8 +38,6 @@
 	isoc99_scanf isoc99_vscanf isoc99_fscanf isoc99_vfscanf isoc99_sscanf \
 	isoc99_vsscanf
 
-install-others = $(inst_includedir)/bits/stdio_lim.h
-
 include ../Makeconfig
 
 aux	:= errlist siglist printf-parsemb printf-parsewc fxprintf
@@ -63,9 +61,6 @@
 
 include ../Rules
 
-$(inst_includedir)/bits/stdio_lim.h: $(common-objpfx)bits/stdio_lim.h $(+force)
-	$(do-install)
-
 ifeq ($(cross-compiling),no)
 .PHONY: do-tst-unbputc do-tst-printf
 tests: do-tst-unbputc do-tst-printf
--- glibc-2.7/Makerules	2007-08-25 22:18:03.000000000 -0400
+++ Makerules.glibc-2.7	2008-01-14 09:17:47.000000000 -0500
@@ -867,6 +867,14 @@
 installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
 			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
 						     $(libprefix)$(libc-name)))
+
+install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \
+               $(inst_slibdir)/libc-$(version).so \
+               $(inst_libdir)/libc.so \
+               $(inst_libdir)/libc.a \
+               install-lib
+
+
 install: $(installed-libcs)
 $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
 	$(make-target-directory)

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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