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]

Re: Failure to boot into cross built environment (iWMMXt NPTL EABI)


--- Mike Frysinger <vapier@gentoo.org> wrote:

> On Monday 24 April 2006 01:40, Steven Newbury wrote:
> > --- Mike Frysinger <vapier@gentoo.org> wrote:
> > > for setting up the cross-compiler there is a helper 'crossdev' script
> > > which takes care of all the mundane details ...
> > > # emerge crossdev
> > > # crossdev arm-iwmmxt-linux-gnueabi
> >
> > I did try that at first but at the time there were no released version of
> > anything with the support in place.  Since I had to dig into and learn
> > about how gcc works I ended up doing all myself anyway.  I've learnt a lot
> > from this project in the last couple of months!
> 
> yeah, that's the trouble with cross-compiling ... not a lot of documentation 
> around as it tends to change often
> 
> but i'd like `crossdev arm-iwmmxt-linux-gnueabi` to "just work" since we have
> 
> all the releases in portage now (binutils-2.16.9x / gcc-4.1.0 / glibc-2.4)
> 
Well with that in mind I've attached my current arm-iwmmxt-linux-gnueabi patch.

> > Yes, great minds think alike; I did just that!  It's a shame a lot of
> > packages are broken with respect to cross compiling, especially python!
> 
> hmm, python should work (or least i fixed it sometime ago, it may have broken
> 
> since) ... if it's failing, please file a bug and assign it to 
> embedded@gentoo.org
It doesn't.  I'll get registered and do that.
> 
> > I did hope I'd be able to cross-compile a working ARM/iWMMXt/NPTL/EABI
> based
> > Gentoo (stage1 at least)!
> 
> i was able to port Gentoo to SuperH/armeb using just emerge and 
> cross-compiling a stage1 ... the stage1->stage3+ i did natively :)
It did seem like a good method I'd come up with.. :-)


Steve


		
___________________________________________________________ 
24 FIFA World Cup tickets to be won with Yahoo! Mail http://uk.mail.yahoo.com
diff -urN gcc-4.1-20060407.orig/gcc/config/arm/iwmmxt-linux-elf.h gcc-4.1-20060407/gcc/config/arm/iwmmxt-linux-elf.h
--- gcc-4.1-20060407.orig/gcc/config/arm/iwmmxt-linux-elf.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-4.1-20060407/gcc/config/arm/iwmmxt-linux-elf.h	2006-04-12 19:35:18.140744636 +0100
@@ -0,0 +1,140 @@
+/* Definitions for Intel PXA270 running Linux-based GNU systems using ELF
+   Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006
+   Free Software Foundation, Inc.
+   Contributed by Philip Blundell <philb@gnu.org>
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 2, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.  If not, write to
+   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* elfos.h should have already been included.  Now just override
+   any conflicting definitions and add any extras.  */
+
+/* Run-time Target Specification.  */
+#undef  TARGET_VERSION
+#define TARGET_VERSION  fputs (" (Intel XScale-iWMMXt ARM GNU/Linux with ELF)", stderr);
+
+#undef  TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
+
+#undef  TARGET_DEFAULT
+#define TARGET_DEFAULT (0)
+
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_iwmmxt
+
+#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
+
+/* Note - there are three possible -mfpu= arguments that can be passed to
+   the assembler:
+   
+     -mfpu=softvfp   This is the default.  It indicates thats doubles are
+                     stored in a format compatible with the VFP
+		     specification.  This is the newer double format, whereby
+		     the endian-ness of the doubles matches the endian-ness
+		     of the memory architecture.
+     
+     -mfpu=fpa       This is when -mhard-float is specified.
+                     [It is not known if any XScale's have been made with
+		     hardware floating point support, but nevertheless this
+		     is what happens].
+		     
+     -mfpu=softfpa   This is when -msoft-float is specified.
+                     This is the normal behavior of other arm configurations,
+		     which for backwards compatibility purposes default to
+		     supporting the old FPA format which was always big
+		     endian, regardless of the endian-ness of the memory
+		     system.  */
+
+#undef  SUBTARGET_EXTRA_ASM_SPEC
+#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=iwmmxt} \
+  %{mhard-float:-mfpu=vfp} \
+  %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
+
+#undef  MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
+
+/* Now we define the strings used to build the spec file.  */
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
+
+/* The native compiler doesn't seem to build if enums are not fixed to 4 bytes */
+#undef CC1_SPEC
+#define CC1_SPEC                                                \
+  "%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} "
+#undef CC1PLUS_SPEC
+#define CC1PLUS_SPEC CC1_SPEC
+
+#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
+
+#define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
+
+#define LINUX_TARGET_LINK_SPEC  "%{h*} %{version:-v} \
+   %{b} \
+   %{static:-Bstatic} \
+   %{shared:-shared} \
+   %{symbolic:-Bsymbolic} \
+   %{rdynamic:-export-dynamic} \
+   %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
+   -X \
+   %{mbig-endian:-EB}" \
+   SUBTARGET_EXTRA_LINK_SPEC
+
+#undef  LINK_SPEC
+#define LINK_SPEC LINUX_TARGET_LINK_SPEC
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	LINUX_TARGET_OS_CPP_BUILTINS();		\
+	  if (flag_pic)				\
+	    {					\
+	  	builtin_define ("__PIC__");	\
+		builtin_define ("__pic__");	\
+	    }					\
+    }						\
+  while (0)
+
+/* This is how we tell the assembler that two symbols have the same value.  */
+#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
+  do					   \
+    {					   \
+      assemble_name (FILE, NAME1); 	   \
+      fputs (" = ", FILE);		   \
+      assemble_name (FILE, NAME2);	   \
+      fputc ('\n', FILE);		   \
+    }					   \
+  while (0)
+
+/* Call the function profiler with a given profile label.  */
+#undef  ARM_FUNCTION_PROFILER
+#define ARM_FUNCTION_PROFILER(STREAM, LABELNO)  			\
+{									\
+  fprintf (STREAM, "\tbl\tmcount%s\n",					\
+	   (TARGET_ARM && NEED_PLT_RELOC) ? "(PLT)" : "");		\
+}
+
+/* The GNU/Linux profiler clobbers the link register.  Make sure the
+   prologue knows to save it.  */
+#define PROFILE_HOOK(X)						\
+  emit_insn (gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, LR_REGNUM)))
+
+/* The GNU/Linux profiler needs a frame pointer.  */
+#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
diff -urN gcc-4.1-20060407.orig/gcc/config/arm/t-iwmmxt-elf gcc-4.1-20060407/gcc/config/arm/t-iwmmxt-elf
--- gcc-4.661-20060407.orig/gcc/config/arm/t-iwmmxt-elf	1970-01-01 01:00:00.000000000 +0100
+++ gcc-4.1-20060407/gcc/config/arm/t-iwmmxt-elf	2006-04-12 19:35:18.140744636 +0100
@@ -0,0 +1,35 @@
+LIB1ASMSRC = arm/lib1funcs.asm
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \
+	_call_via_rX _interwork_call_via_rX \
+	_lshrdi3 _ashrdi3 _ashldi3 \
+	_negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
+	_truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
+	_fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundidf _floatundisf \
+	_unwind
+
+MULTILIB_OPTIONS    += mcpu=iwmmxt
+MULTILIB_DIRNAMES   += iwmmxt
+MULTILIB_REDUNDANT_DIRS += interwork/thumb/iwmmxt=thumb
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
+
+# If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here
+# EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+# Currently there is a bug somewhere in GCC's alias analysis
+# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
+# Disabling function inlining is a workaround for this problem.
+TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline
+
+# Assemble startup files.
+$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+	-c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm
+
+$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+	-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm
+
diff -urN gcc-4.1-20060407.orig/gcc/config.gcc gcc-4.1-20060407/gcc/config.gcc
--- gcc-4.1-20060407.orig/gcc/config.gcc	2006-04-12 19:34:15.220929804 +0100
+++ gcc-4.1-20060407/gcc/config.gcc	2006-04-12 19:35:18.140744636 +0100
@@ -671,12 +671,22 @@
 	use_collect2=yes
 	;;
 arm*-*-linux*)			# ARM GNU/Linux with ELF
-	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" 
+	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h" 
+	case ${target} in
+		arm*-iwmmxt-*)
+			tmake_file="${tmake_file} arm/t-iwmmxt-elf"
+			tm_file="${tm_file} arm/iwmmxt-linux-elf.h"
+			;;
+		*)
+			tmake_file="${tmake_file} arm/t-arm-elf"
+			tm_file="${tm_file} arm/linux-elf.h"
+			;;
+	esac
 	tmake_file="${tmake_file} t-linux arm/t-arm"
 	case ${target} in
 	arm*-*-linux-gnueabi)
 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
-	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
+	    tmake_file="$tmake_file arm/t-bpabi arm/t-linux-eabi"
   	    # The BPABI long long divmod functions return a 128-bit value in 
 	    # registers r0-r3.  Correctly modeling that requires the use of
 	    # TImode.

--
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]