PATCH: Correctly configure all big-endian ARM archs, not just arm*-*-linux-*.

Seth LaForge sethml@google.com
Fri Feb 15 19:16:00 GMT 2013


On Fri, Feb 15, 2013 at 10:41 AM, Richard Earnshaw <rearnsha@arm.com> wrote:
> On 15/02/13 18:33, Seth LaForge wrote:
>> If so, I could certainly change the test to use a regexp, or inline it
>> all of the ARM handlers in the case statement below.
>
> Yes, anything with linux in it will now be a quadruplet.  There may be other
> cases as well.  Once a rule has been broken for one case, you can hardly
> enforce it against others.  The rot has set in...

Ooo, messy.

Given that config.gcc seems to have a lot of assumptions that $target
is a triplet baked in, seems like it'd make sense to have a bit of
code at the top that parsed target into four variables, and then have
the various case statements use those variables, something like:

# arm-blob-linux-gnueabi -> proc=arm thingy=blob os=linux abi=gnueabi
proc=`expr ${target} : '^\([^-]*\)-'`
thingy=`expr ${target} : '^[^-]*-\([^-]*\)-[^-]*-[^-]*$'`
os=`expr ${target} : '^.*-\([^-]*\)-[^-]*$'`
abi=`expr ${target} : '^.*-[^-]*-\([^-]*\)$'`

case $proc/$thingy/$os/$abi in
  arm*/blob/linux/*) ... ;;
  arm*/*/*/eabi) ... ;;
esac

That'd be a major clean-up, though.  How about the version of my patch
below?  If you hate the use of expr, I could inline the test into all
of the ARM cases below, but I don't like that approach since it's what
caused this problem in the first place (somebody adding BE support to
one ARM arch without adding it to the others).

Seth

diff -urp gcc-4.8-20130210.orig/gcc/config.gcc gcc-4.8-20130210/gcc/config.gcc
--- gcc-4.8-20130210.orig/gcc/config.gcc	2013-02-08 08:02:47.000000000 -0800
+++ gcc-4.8-20130210/gcc/config.gcc	2013-02-15 11:01:56.049978834 -0800
@@ -809,6 +809,11 @@ case ${target} in
   ;;
 esac

+# Handle big-endian ARM architectures.
+if expr ${target} : 'arm[^-]*b-' >/dev/null ; then
+  tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+fi
+
 case ${target} in
 aarch64*-*-elf)
 	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
@@ -867,11 +872,6 @@ arm*-*-netbsdelf*)
 	;;
 arm*-*-linux-*)			# ARM GNU/Linux with ELF
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
-	case $target in
-	arm*b-*-linux*)
-	    tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
-	    ;;
-	esac
 	tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi
arm/t-linux-eabi"
 	tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h arm/arm.h"
 	# Define multilib configuration for arm-linux-androideabi.



More information about the Gcc-patches mailing list