Skip to content

Fixes to the FreeBSD arm64 bridge - #511

Merged
pgiffuni merged 2 commits into
apache:trunkfrom
pgiffuni:trunk
Oct 22, 2026
Merged

pgiffuni merged 2 commits into
apache:trunkfrom
pgiffuni:trunk

Conversation

@pgiffuni

Copy link
Copy Markdown
Contributor

With these changes the testtools/bridgetest passes on FreeBSD/aarch64.

Fix two issues in the FreeBSD aarch64 C++-UNO bridge:

1. abi.cxx: align_stack_offset and stack_size now use the type's
   natural alignment (nAlignment) and raw size (nSize) instead of
   hardcoded 8/alignment and 8-byte slot rounding. This matches the
   AAPCS64/System V ABI requirement that stack arguments use their
   natural alignment and size, matching the macOS reference.

2. uno2cpp.cxx: Restructure the return-value switch to use 'default'
   with a bSimpleReturn check (matching the macOS reference), so
   fill_struct is only called for register-returned aggregates, not
   for types that use the x8 hidden-result buffer.
Ensure each stack argument occupies a full 8-byte slot per AAPCS64
requirements. Small types (BYTE, SHORT, LONG, BOOLEAN, etc.) are now
sign/zero-extended into a sal_uInt64 scratch slot before being copied
to the stack, preventing garbage values from uninitialized upper bytes.

This fixes the testPackedStack BridgeTest failure where nStack was
24 instead of the expected 48, and resolves the cascading transportAny
crash caused by corrupt stack values.
@pgiffuni
pgiffuni merged commit 0b229ce into apache:trunk Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant