Returning structs in registers - ARM ABI in GCC

前端 未结 4 735
一整个雨季
一整个雨季 2021-01-13 18:01

In the ARM ABI documentation I come across functions defined like:

__value_in_regs struct bar foo(int a, int b) {
    ...
}

but GCC(4.3

4条回答
  •  孤街浪徒
    2021-01-13 18:45

    The "Procedure Call Standard for the ARM Architecture" specifically says (section 5.4: Result Return):

    "A Composite Type not larger than 4 bytes is returned in R0."

    "A Composite Type larger than 4 bytes ... is stored in memory at an address passed as an extra argument when the function was called ... ."

    I know that some CPUs have several different "standard" ABIs. But I was under the impression that practically all compilers for the ARM used this same ABI.

    Do you have any evidence that GCC doesn't use this standard ABI?

    Would you mind posting a link to any information on a ABI for the ARM that is different from this standard ABI -- the ABI used by the caller, or the called, or both?

提交回复
热议问题