This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] armbe-linux target defaults to big-endian
- From: David Vrabel <dvrabel at arcom dot com>
- To: binutils at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Oct 2003 10:11:40 +0100
- Subject: [patch] armbe-linux target defaults to big-endian
- Organization: Arcom Control Systems Ltd
Hi,
The attached patches (for binutils 2.14 and GCC 3.3.1) add/fix the
armbe-linux target so that big-endian code is generated by default.
It works for what I want but I suspect it's not done properly.
David Vrabel
--
David Vrabel, Design Engineer
Arcom Tel: +44 (0)1223 411200 ext. 3233
Clifton Road Fax: +44 (0)1223 403400
Cambridge CB1 7EA E-mail: dvrabel@arcom.com
UK Web: http://www.arcom.com/
_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.
This message has been checked for all viruses by MessageLabs Virus Control Centre.diff -urN binutils-2.14.orig/gas/configure.in binutils-2.14/gas/configure.in
--- binutils-2.14.orig/gas/configure.in 2003-06-02 21:35:23.000000000 +0100
+++ binutils-2.14/gas/configure.in 2003-10-03 11:35:04.000000000 +0100
@@ -115,6 +115,7 @@
endian=
case ${cpu} in
alpha*) cpu_type=alpha ;;
+ arm*be|xscale*be|strongarm*be) cpu_type=arm endian=big ;;
arm*b|xscale*b|strongarm*b) cpu_type=arm endian=big ;;
arm*|xscale*|strongarm*) cpu_type=arm endian=little ;;
hppa*) cpu_type=hppa ;;
diff -urN binutils-2.14.orig/ld/configure.tgt binutils-2.14/ld/configure.tgt
--- binutils-2.14.orig/ld/configure.tgt 2003-06-12 15:25:52.000000000 +0100
+++ binutils-2.14/ld/configure.tgt 2003-10-02 15:08:33.000000000 +0100
@@ -244,6 +244,8 @@
arm-*-kaos*) targ_emul=armelf ;;
arm9e-*-elf) targ_emul=armelf ;;
arm-*-oabi) targ_emul=armelf_oabi ;;
+arm*be-*-linux-gnu*) targ_emul=armbeelf_linux; targ_extra_emuls=armbeelf ;;
+arm*b-*-linux-gnu*) targ_emul=armbeelf_linux; targ_extra_emuls=armbeelf ;;
arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-conix*) targ_emul=armelf ;;
diff -urN binutils-2.14.orig/ld/emulparams/armbeelf_linux.sh binutils-2.14/ld/emulparams/armbeelf_linux.sh
--- binutils-2.14.orig/ld/emulparams/armbeelf_linux.sh 1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.14/ld/emulparams/armbeelf_linux.sh 2003-10-02 10:33:06.000000000 +0100
@@ -0,0 +1,17 @@
+ARCH=arm
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-bigarm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+MAXPAGESIZE=0x8000
+TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=armelf
+GENERATE_SHLIB_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+TEXT_START_ADDR=0x00008000
diff -urN binutils-2.14.orig/ld/emulparams/armbeelf.sh binutils-2.14/ld/emulparams/armbeelf.sh
--- binutils-2.14.orig/ld/emulparams/armbeelf.sh 1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.14/ld/emulparams/armbeelf.sh 2003-10-02 10:33:59.000000000 +0100
@@ -0,0 +1,25 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-bigarm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+TEXT_START_ADDR=0x8000
+TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=armelf
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+DATA_START_SYMBOLS='__data_start = . ;';
+
+GENERATE_SHLIB_SCRIPT=yes
+
+ARCH=arm
+MACHINE=
+MAXPAGESIZE=256
+ENTRY=_start
+EMBEDDED=yes
+
+# This sets the stack to the top of the simulator memory (2^19 bytes).
+STACK_ADDR=0x80000
diff -urN binutils-2.14.orig/ld/Makefile.am binutils-2.14/ld/Makefile.am
--- binutils-2.14.orig/ld/Makefile.am 2003-04-24 13:36:07.000000000 +0100
+++ binutils-2.14/ld/Makefile.am 2003-10-02 15:13:31.000000000 +0100
@@ -118,8 +118,10 @@
earmaoutl.o \
earmcoff.o \
earmelf.o \
+ earmbeelf.o \
earmelf_fbsd.o \
earmelf_linux.o \
+ earmbeelf_linux.o \
earmelf_nbsd.o \
earmelfb_nbsd.o \
earmelf_oabi.o \
@@ -457,6 +459,10 @@
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} armelf "$(tdir_armelf)"
+earmbeelf.c: $(srcdir)/emulparams/armbeelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armbeelf "$(tdir_armbeelf)"
earmelf_oabi.c: $(srcdir)/emulparams/armelf_oabi.sh \
$(srcdir)/emultempl/armelf_oabi.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} armelf_oabi "$(tdir_armelf)"
@@ -469,6 +475,10 @@
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} armelf_linux "$(tdir_armelf_linux)"
+earmbeelf_linux.c: $(srcdir)/emulparams/armbeelf_linux.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armbeelf_linux "$(tdir_armbeelf_linux)"
earmelf_nbsd.c: $(srcdir)/emulparams/armelf_nbsd.sh \
$(srcdir)/emulparams/armelf.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \
diff -urN gcc-3.3.1.orig/gcc/config/arm/be-linux-elf.h gcc-3.3.1/gcc/config/arm/be-linux-elf.h
--- gcc-3.3.1.orig/gcc/config/arm/be-linux-elf.h 1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.3.1/gcc/config/arm/be-linux-elf.h 2003-10-03 11:07:04.000000000 +0100
@@ -0,0 +1,42 @@
+/* Definitions for ARM (big-endian) running Linux-based GNU systems using ELF
+ Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
+ Contributed by Philip Blundell <philb@gnu.org>
+
+This file is part of GNU CC.
+
+GNU CC 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.
+
+GNU CC 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, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* linux-elf.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 (" (ARM (big-endian) GNU/Linux with ELF)", stderr);
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | ARM_FLAG_BIG_END)
+
+#undef SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC " -m armbeelf_linux -p"
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+ { "marm", "mbig-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
+
+/* Default is big endian, which defines __ARMEB__ */
+#undef CPP_ENDIAN_DEFAULT_SPEC
+#define CPP_ENDIAN_DEFAULT_SPEC "-D__ARMEB__"
diff -urN gcc-3.3.1.orig/gcc/config/arm/linux-elf.h gcc-3.3.1/gcc/config/arm/linux-elf.h
--- gcc-3.3.1.orig/gcc/config/arm/linux-elf.h 2002-12-10 10:55:31.000000000 +0000
+++ gcc-3.3.1/gcc/config/arm/linux-elf.h 2003-10-03 11:05:08.000000000 +0100
@@ -86,7 +86,7 @@
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
-X \
- %{mbig-endian:-EB}" \
+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
#define TARGET_OS_CPP_BUILTINS() \
diff -urN gcc-3.3.1.orig/gcc/config.gcc gcc-3.3.1/gcc/config.gcc
--- gcc-3.3.1.orig/gcc/config.gcc 2003-06-27 12:44:22.000000000 +0100
+++ gcc-3.3.1/gcc/config.gcc 2003-10-03 10:37:25.000000000 +0100
@@ -697,6 +697,17 @@
extra_parts=""
use_collect2=yes
;;
+arm*be-*-linux*|arm*b-*-linux*) # ARM (big-endian) GNU/Linux with ELF
+ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/be-linux-elf.h"
+ tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
+ case x${enable_threads} in
+ x | xyes | xpthreads | xposix)
+ thread_file='posix'
+ ;;
+ esac
+ ;;
arm*-*-linux*) # ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h"
tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"