RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddindLayout

Jorn Vernee jvernee at openjdk.org
Fri Sep 20 10:36:37 UTC 2024


On Fri, 20 Sep 2024 08:41:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The javadoc of the `Linker` also states that:
> 
> > [A group layout] G does not contain padding other than what is strictly required to align
> > its non-padding layout elements, or to satisfy (2) [the size of {@code G} is a multiple of its alignment constraint]
> 
> I believe it is the intent here to rule out empty groups, or groups that contain only padding. Should we address that here (as I believe that once we add more checks, we'll need more tweaks to make the various exception more uniform) ?

Empty structs are supported by GCC, and the size of such a struct is actually 0 bytes in C (as opposed to C++): https://godbolt.org/z/hvoc88oE7 So they should be allowed I think. (We don't currently reject them at least)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21041#issuecomment-2363402197


More information about the core-libs-dev mailing list