Skip to content

[libc][arm][setjmp/longjmp] enforce minimum sizes #94071

Open
@nickdesaulniers

Description

@nickdesaulniers

https://github.com/ARM-software/abi-aa/blob/main/clibabi32/clibabi32.rst#setjmph

The minimum jmp_buf size is calculated as follows:
SP, LR: 2x4; reserved to setjmp implementation: 4x4; Total 3x8 bytes
General purpose register save: 8x4; Total 4x8 bytes
Floating point register save: 8x8; Total 8x8 bytes
WMMX (if present): 5x8; Total 5x8 bytes
Total: 20x8 = 160 bytes = 20 8-byte double-words.
If WMMX can be guaranteed not to be present this can be reduced to 15x8 = 120 bytes.
If floating point hardware can be guaranteed not to be present this can be further reduced to 7x8 = 56 bytes.
An implementation may define the size of a jmp_buf to be larger than the ABI-defined minimum size.

We can enforce this via static_asserts in the implementations of setjmp+longjmp. We don't plan to support WMMX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions