On Tue, Sep 12, 2017 at 2:32 AM, Jürg Billeter <juerg.bille...@codethink.co.uk> wrote: > Hi, > > To support applications that assume big-endian memory layout on little- > endian systems, I'm considering adding support for reversing the > storage order to GCC. In contrast to the existing scalar storage order > support for structs, the goal is to reverse the storage order for all > memory operations to achieve maximum compatibility with the behavior on > big-endian systems, as far as observable by the application. > > The plan is to insert byte swapping instructions as part of the RTL > expansion of GIMPLE assignments that access memory. This would leverage > code that was added for -fsso-struct, keeping the code simple and > maintainable. It should not be necessary to insert byte swapping > instructions for spilled registers. > > Is this something that GCC upstream would be interested to accept? > > To facilitate byte swapping at endian boundaries (kernel or libraries), > I'm also considering developing a new GCC builtin that can byte-swap > whole structs in memory. There are limitations to this, e.g., unions > could not be supported in general. However, I still expect this to be > very useful. > > Any comments or suggestions? > > Best regards, > Jürg
Can you use __attribute__ ((scalar_storage_order)) in GCC 7? -- H.J.