How to change bit-field allocation

DJ Delorie dj@redhat.com
Tue Sep 7 01:24:00 GMT 2004


> As I know, GCC allocates bit-fields inside a structure from the
> lowest addressed byte, i.e. LSB, for little endian. However, I want
> to reverse the ordering for the bit-fields allocation, i.e. always
> from MSB.

I submitted a patch to do this a while back as part of my Renesas
patches.  It was rejected as it exceeded the hack threshold for the
code it was modifying.  I recently submitted a proposal to move the
bitfield layout code into a set of target hooks, so that different
methods could be implemented more cleanly, but it has yet to be
approved.

The first passes at the patch (We've since fixed some bugs in this
internally, since we still use it for some internal branches):
http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02503.html
http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00815.html
(or search for "reverse_bitfield_layout")

Request to make it into target hooks:
http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00132.html

Proposal to move to target hooks:
http://gcc.gnu.org/ml/gcc/2004-06/msg01193.html



More information about the Gcc mailing list