RFR: 8303002: Reject packed structs from linker

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Mar 27 14:54:37 UTC 2023


On Thu, 23 Mar 2023 18:11:18 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This patch adds checks in AbstractLinker to reject packed structs and structs with excess padding (e.g. unnamed bitfields), since both of those are currently not supported, and the ABI/spec seems too vague to base support on.

src/java.base/share/classes/java/lang/foreign/Linker.java line 200:

> 198:  * </table></blockquote>
> 199:  * <p>
> 200:  * Note that due to limited ABI specification coverage, none of the native linker implementations supports

Is there something bigger to say here? E.g. can I pass a C int with an alignment other than its size? E.g. is there a requirement that the alignment of _all_ layouts should be identical to their natural alignment? If so, we should say so.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13164#discussion_r1149370526


More information about the core-libs-dev mailing list