DJ Delorie <d...@redhat.com> writes:

> In the RX chip (and others, of course), the memory-mapped peripherals
> have a fixed bit-ordering independent of the endianness of data.
> However, GCC defines bitfields in structures differently for different
> endians - effectively always beginning allocations with the lowest
> addressed byte.

First I have to say that people should not use bitfields to access
memory mapped peripherals.  However, at least this case is not as bad as
the volatile bitfields issue.

It seems to me that the answer is not a target hook to reverse
bitfields, it is some way of saying how bitfields should be counted
within a larger structure.  E.g., BITFIELDS_BIG_ENDIAN.  The default
would simply be BITS_BIG_ENDIAN as it presumably is today.

> (alternately, there could be a target-independent attribute (such as
> above), but in the RX case, compatibility with other RX compilers
> means the target needs to use a pragma)

If you need type attributes for this beyond a simple macro, then I agree
that they should be target independent.

Ian

Reply via email to