Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

update calling convention to match GCC behavior #49

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/LoongArch-ELF-ABI-EN.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,20 @@ If only one GAR is available, the low-order bits are in the GAR and the high-ord
.. It’s passed by reference and are replaced in the argument list with the address.
If there is an available GAR, the reference is passed in the GAR, and passed on the stack if no GAR is available.

. Special Cases

.. If WOA ≤ 2 × GRLEN, and the structure contains zero-length array (as a GNU extension) members or zero-width bit-field members:

... Let `f(T)` be the predicate to denote if there is any zero-length array member of which the element type is `T`, or an array, structure, or union containing (directly or indirectly) `T`.

... If the structure only contains one `float` member besides those zero-length array or zero-width bit-field members, and both `f(double)` and `f(long double)` are not true, the structure is passed in one FAR.

... If the structure only contains one `double` member besides those zero-length array or zero-width bit-field members, and `f(long double)` is not true, the structure is passed in one FAR.

... Otherwise, the structure is passed via GAR and/or stack. No FAR shall be used.

.. If a structure contains (directly or indirectly) an union, and the union occupies non-zero bits of space in the memory layout of this structure, this structure is passed via GAR and/or stack as if the structure itself is an union. No FAR shall be used.

Structure and scalars passed on the stack are aligned to the greater of the type alignment and GRLEN bits, but never more than the stack alignment.

==== Union
Expand Down