ARM fix for big endian linux-elf targets

Sebastian Pop sebastian.pop@cri.ensmp.fr
Mon Nov 14 20:30:00 GMT 2005


Hi,

GCC cannot be built for big endian ARM linux-elf targets, ending on
some ld error message like that:

../arm-xscale-linux-gnu-ld: unrecognised emulation mode: armelf_linux
Supported emulations: armelfb_linux armelfb

With this patch we're now able to finish the build of the compiler.
Tested by building a cross compiler for armeb-linux.

Sebastian

	* config.gcc (arm*b-*-linux*): Add it.  Include linux-elfb.h.
	* config/arm/linux-elfb.h: New file.  Redefine LINK_SPEC and
	MULTILIB_DEFAULTS.

Index: config.gcc
===================================================================
--- config.gcc	(revision 106590)
+++ config.gcc	(working copy)
@@ -674,6 +674,9 @@ arm*-*-linux*)			# ARM GNU/Linux with EL
 	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" 
 	tmake_file="${tmake_file} t-linux arm/t-arm"
 	case ${target} in
+	arm*b-*-linux*)
+	    tm_file="$tm_file arm/linux-elfb.h"
+	    ;;
 	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"
Index: config/arm/linux-elfb.h
===================================================================
--- config/arm/linux-elfb.h	(revision 0)
+++ config/arm/linux-elfb.h	(revision 0)
@@ -0,0 +1,48 @@
+/* Configuration file for big endian ARM GNU/Linux targets.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   Contributed by Sebastian Pop <pop@cri.ensmp.fr>
+
+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 GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+/* Redefine MULTILIB_DEFAULTS with mbig-endian.  */
+#undef  MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+	{ "marm", "mbig-endian", "mhard-float", "mno-thumb-interwork" }
+
+/* The value of LINUX_TARGET_INTERPRETER is inherited from linux-elf.h
+   that is included before this file.  */
+
+/* Redefine LINK_SPEC with armelfb_linux.  */
+#undef SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC " -m armelfb_linux -p"
+
+#undef LINUX_TARGET_LINK_SPEC
+#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
+



More information about the Gcc-patches mailing list