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

login
register
mail settings
Submitter Richard Earnshaw
Date Feb. 22, 2013, 4:02 p.m.
Message ID <51279692.8080106@arm.com>
Download mbox | patch
Permalink /patch/222552/
State New
Headers show

Comments

Richard Earnshaw - Feb. 22, 2013, 4:02 p.m.
On 20/02/13 23:21, Seth LaForge wrote:
> On Fri, Feb 15, 2013 at 3:29 PM, Mike Stump <mikestump@comcast.net> wrote:
>> No.  Counter proposal, let's handle the cases that don't work.  So, you said in your original email that armeb-unknown-eabi doesn't work.
>>
>> So, in the existing case statement for:
>>
>> arm*-*-eabi*)
>>
>> let's just add:
>>
>>          case ${target} in
>>          armeb-*-eabi*)
>>            tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
>>          esac
>>
>> Is this not exactly what you want?  Doesn't this solve exactly what you stated was the problem?
>
> OK, attached patch
> 0001-Add-TARGET_BIG_ENDIAN_DEFAULT-1-for-all-armeb-eabi-a.patch does
> as you describe, and works for my particular use-case.
>
>>> 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).
>>
>> And does it work on uclinux?  Does it work on rtems?  Does it work on every arm that every existed and will exist?  If the answer is no, then it is less ideal than putting this in the config for eabi*).
>
> Well, the current config is certainly broken when giving a big-endian
> spec for uclinux, rtems, and every other arm that ever existed or will
> exist.  It's possible there are other issues with using a big-endian
> processor for uclinux, rtems, etc, but adding
> TARGET_BIG_ENDIAN_DEFAULT=1 certainly gets those targets closer to
> working.
>
>> If it always works, then moving the existing on up to the existing:
>>
>> case ${target} in
>> i[34567]86-*-*)
>>
>> would be the right approach.  x86 uses this location already to set tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" for example.  The documentation above that group can state that this is the location for things that are cpu specific and os and vendor neutral.
>
> I like that solution better.  Following your suggested list of
> big-endian architectures, attached patch
> 0001-Add-TARGET_BIG_ENDIAN_DEFAULT-1-for-all-arm-big-endi.patch adds
> TARGET_BIG_ENDIAN_DEFAULT=1 for $target matching "armeb-* | armbe-* |
> armv[3-8]b-*".  I left out xscaleeb, since config.sub canonicalizes
> xscaleeb-* to armeb-*.
>
> Please, pick whichever patch pleases you most.  I prefer
> 0001-Add-TARGET_BIG_ENDIAN_DEFAULT-1-for-all-arm-big-endi.patch.
>
> Changelog entry for
> 0001-Add-TARGET_BIG_ENDIAN_DEFAULT-1-for-all-arm-big-endi.patch:
>
> gcc/
> 	* config.gcc: Add TARGET_BIG_ENDIAN_DEFAULT=1 for all arm big-endian archs.
>
> Changelog entry for
> 0001-Add-TARGET_BIG_ENDIAN_DEFAULT-1-for-all-armeb-eabi-a.patch:
>
> gcc/
> 	* config.gcc: Add TARGET_BIG_ENDIAN_DEFAULT=1 for all armeb-*-eabi* archs.
>

This is what I've put in.  Which is a slight relaxation on your second 
version.

R.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 196220)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@ 
+2013-02-22  Seth LaForge  <sethml@google.com>
+
+	* config.gcc (arm*-*-eabi*): Treat arm*eb as big-endian.
+
 2013-02-22  Greta Yorsh  <Greta.Yorsh@arm.com>
 
         * config/arm/arm.md (split for extendsidi): Update condition.
Index: config.gcc
===================================================================
--- config.gcc	(revision 196220)
+++ config.gcc	(working copy)
@@ -900,6 +900,10 @@  arm*-*-uclinux*eabi*)		# ARM ucLinux
 	default_use_cxa_atexit=yes
 	;;
 arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
+	case ${target} in
+	arm*eb-*-eabi*)
+	  tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+	esac
 	# The BPABI long long divmod functions return a 128-bit value in
 	# registers r0-r3.  Correctly modeling that requires the use of
 	# TImode.