On Feb 15, 2013, at 11:15 AM, Seth LaForge <[email protected]> wrote:
> On Fri, Feb 15, 2013 at 10:41 AM, Richard Earnshaw <[email protected]> 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:
No. That is wrong. We can't be messy if we had structure. The messy is to
forever defeat any and every strict mandate that one could ever envision. I
know, seems wrong and backwards, but there is a reason for it. By having it
loose, we get to adapt it anyway we want over long periods of time to meet any
need we might then have.
> # 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
You've just reinvented target triplets but changed the - to be a /. Since they
are totally isomorphic, you've not done anything but change it, and change is
bad.
> How about the version of my patch
> below?
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?
> If you hate the use of expr,
I do.
> 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*). 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.