Boaz Harrosh wrote:
> I would at least expect a big fat comment explaining what happened to the
> structure on what known ARCHs, and how it is expected to look in memory.
> And a BUILD_BUG_ON to make sure of that.
You may have a point.
Struct layout on some architectures changes between compiler default
ABIs in these implicit-padding cases. Kernel binary compatibility
will be affected. It is a good reason why we have explicit padding to
natural alignment normally.
"With the new ABI, default structure packing changes, as do some
default data sizes and alignment (which also have a knock-on effect on
structure packing). In particular the minimum size and alignment of a
structure was 4 bytes. Under the EABI there is no minimum and the
alignment is determined by the types of the components it
contains. This will break programs that know too much about the way
structures are packed and can break code that writes binary files by
dumping and reading structures."
"One of the key differences between the traditional GNU/Linux ABI
and the EABI is that 64-bit types (like long long) are aligned
differently. In the traditional ABI, these types had 4-byte alignment;
in the EABI they have 8-byte alignment. As a result, if you use the
same structure definitions (in a header file) and include it in code
used in both the kernel and in application code, you may find that the
structure size and alignment differ."