I have built an EABI/iWMMXt Gentoo based system. The toolchain I used is modified to add a Linux/EABI/iWMMXt target. It has been fine until I changed my binutils from an earlier snapshot to a current version Gentoo 2.16.92, csl-2_17-branch or CVS trunk. Now when attempting to build GCC (on the host) I get the following error:
gcc -c -O2 -march=iwmmxt -mcpu=iwmmxt -pipe -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute -DHAVE_CONFIG_H -I. -Icp -I/var/tmp/portage/gcc-4.1.1/work/gcc-4.1-20060505/gcc -I/var/tmp/portage/gcc-4.1.1/work/gcc-4.1-20060505/gcc/cp -I/var/tmp/portage/gcc-4.1.1/work/gcc-4.1-20060505/gcc/../include -I/var/tmp/portage/gcc-4.1.1/work/gcc-4.1-20060505/gcc/../libcpp/include /var/tmp/portage/gcc-4.1.1/work/gcc-4.1-20060505/gcc/cp/typeck2.c -o cp/typeck2.o {standard input}: Assembler messages: {standard input}:2391: Error: iWMMXt control register expected -- `tmcr wcgr0,r1' This occurs if I attempt to build GCC trunk or 4.1.1 and I suspect 4.1.0 but I haven't tested it. I have attached my patch for the Linux/EABI/iWMMXt target. Steve Send instant messages to your online friends http://uk.messenger.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 <[EMAIL PROTECTED]> + + 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 Linux compiler doesn't build if enums are not int sized */ +#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-bpabi gcc-4.1-20060407/gcc/config/arm/t-bpabi --- gcc-4.1-20060407.orig/gcc/config/arm/t-bpabi 2005-11-04 14:51:20.000000000 +0000 +++ gcc-4.1-20060407/gcc/config/arm/t-bpabi 2006-04-12 19:35:18.140744636 +0100 @@ -1,5 +1,6 @@ # Add the bpabi.S functions. -LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod +LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod \ + _unwind # Add the BPABI C functions. LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \ 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.1-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.