This is the mail archive of the gcc-bugs@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: Building IA-64 gcc breaks


On Thu, May 08, 2003 at 04:29:00PM -0400, Jim Wilson wrote:
> navin wrote:
> > ../../gcc-3.2/gcc/config/ia64/fde-glibc.c:42:3: #error You need GLIBC 
> > 2.2.4 or later on IA-64 Linux
> 
> You need a newer copy of glibc.  The one you have is too old to work 
> with gcc 3.x.
> 
> > 2)I saw on the posts that we could do that same by doing gcc and glibc in 
> > parallel.
> 
> This is a general linux cross compiler problem, not an IA-64 problem. 
> We have instructions on how to build a cross compiler to an embedded 
> target that uses newlib, but we have no documented process for building 
> a cross compiler to a linux target that uses glibc if you don't already 
> have access to such a system.  I don't know how to do this offhand.  I 
> believe it is considerably more complicated than an embedded cross.  You 
> could ask for general help on doing gcc/glibc cross builds for linux, 
> and avoid mentioning IA-64 since that might confuse people who don't do 
> IA-64 work.
> 
> Jim
> 
 
Someone was asking me about this recently, and here's what I learned.

Normally, to build a cross toolchain from scratch you do the following:

  1. Build binutils.
  2. Build a minimal C cross compiler (no support for shared libraries,
     threads, or anything else that requires help from glibc).
 [3. Build the Linux kernel?]
  4. Build cross glibc.
  5. Build fully-function cross compilers.

The second step doesn't work for IA-64 because there are assumptions
that glibc is available.  This patch allows it to work; it's followed by
a script to get through steps 1 and 2.  I haven't tried the other steps
for ia64-linux.  Building glibc requires having Linux sources available,
and perhaps even doing a kernel build first.

Janis

--- gcc/unwind.h.orig	Tue Apr 22 15:59:41 2003
+++ gcc/unwind.h	Tue Apr 22 16:00:07 2003
@@ -166,7 +166,7 @@ extern void _Unwind_SjLj_Resume (struct 
    and data-relative addressing in the LDSA.  In order to stay link
    compatible with the standard ABI for IA-64, we inline these.  */
 
-#ifdef __ia64__
+#if defined(__ia64__) && !defined(inhibit_libc)
 #include <stdlib.h>
 
 static inline _Unwind_Ptr
--- gcc/config/ia64/fde-glibc.c.orig	Tue Apr 22 11:07:44 2003
+++ gcc/config/ia64/fde-glibc.c	Tue Apr 22 16:17:59 2003
@@ -25,6 +25,18 @@
    This exception does not however invalidate any other reasons why
    the executable file might be covered by the GNU General Public License.  */
 
+#if defined(inhibit_libc)
+/* If libc and its header files are not available, provide a dummy function.  */
+
+void *
+_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
+                        unsigned long *gp)
+{
+  return (void *)0;
+}
+
+#else
+
 /* Locate the FDE entry for a given address, using glibc ld.so routines
    to avoid register/deregister calls at DSO load/unload.  */
 
@@ -162,3 +174,5 @@ _Unwind_FindTableEntry (void *pc, unsign
 
   return data.ret;
 }
+
+#endif  /* inhibit_libc */
--- gcc/config/ia64/linux.h.orig	Tue Apr 22 15:47:53 2003
+++ gcc/config/ia64/linux.h	Tue Apr 22 15:48:20 2003
@@ -54,8 +54,10 @@
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
 #ifdef IN_LIBGCC2
+#ifndef inhibit_libc
 #include <signal.h>
 #include <sys/ucontext.h>
+#endif
 
 #define IA64_GATE_AREA_START 0xa000000000000100LL
 #define IA64_GATE_AREA_END   0xa000000000020000LL
--- gcc/config/ia64/unwind-ia64.c.orig	Tue Apr 22 16:14:21 2003
+++ gcc/config/ia64/unwind-ia64.c	Tue Apr 22 16:16:23 2003
@@ -37,6 +37,13 @@
 #include "unwind-ia64.h"
 #include "ia64intrin.h"
 
+#ifdef inhibit_libc
+#undef MD_FALLBACK_FRAME_STATE_FOR
+#define abort __builtin_abort
+#define memcpy __builtin_memcpy
+#define memset __builtin_memset
+#endif
+
 /* This isn't thread safe, but nice for occasional tests.  */
 #undef ENABLE_MALLOC_CHECKING
----------------------------------------------------------------------- 


#! /bin/sh

CC=$cc_compiler_with_which_to_build
PREFIX=$location_of_newly_built_tools

mkdir binutils-obj
cd binutils-obj
CC=${CC} ../binutils-2.12.1/configure \
    --prefix=${PREFIX} \
    --build=i686-pc-linux-gnu \
    --host=i686-pc-linux-gnu \
    --target=ia64-linux \
    --disable-nls \
  > configure.log 2>&1
make > make.log 2>&1
make install > make.install.log 2>&1

cd ..
mkdir gcc-obj
cd gcc-obj
CC=${CC} ../gcc-3.2.1/configure \
    --prefix=${PREFIX} \
    --build=i686-pc-linux-gnu \
    --host=i686-pc-linux-gnu \
    --target=ia64-linux \
    --disable-nls \
    --disable-threads \
    --disable-shared \
    --enable-languages=c \
  > configure.log 2>&1
make > make.log 2>&1
make install > make.install.log 2>&1


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