Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE

Andrew Cagney
2002-01-20T19:00:37Z

> On Sun, Jan 20, 2002 at 01:33:29PM -0500, Andrew Cagney wrote:
>
>> >
>> >Woah! That's neat! I need to remember that :)
>> >
>> >And I suppose I of all people shouldn't be griping about allowing more
>> >endianness choices. I have a patch here to support big-endian
>> >ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
>
>>
>>
>> Delete it :-) As Michael observed, if the code is written correctly it
>> works from day one. (Problem is it has taken ~10 years to figure out
>> how to correctly write the code :-)
>
>
> Well, I need to set TARGET_BYTE_ORDER_DEFAULT. If you start a cross
> debugger without giving it a binary, and attach to a random remote
> target, then we need to default to the right one. Other than that
> everything is fine, though!

Nope! I'm about to delete TARGET_BYTE_ORDER_DEFAULT.

There is this really nasty bit of code in arch-utils.c that roots around
the internals of BFD and uses that to determine the initial architecture
and byte-order. Doing this ensures that GDB's behavour is better
aligned with that of BINUTILS.
See arch-utils.c:initialize_current_architecture().

If GDB initializes its self to the wrong byte-order then there is likely
a bug in BFD.

Did I mention that we live in dangerous times :-)
Andrew

PS: Actually the code isn't that bad. What makes it nasty is the need
to prop up the old non-multi-arch behavour.