libucontext icon indicating copy to clipboard operation
libucontext copied to clipboard

common-trampoline: Ensure omission of frame-pointer

Open nmeum opened this issue 1 year ago • 1 comments

Some architecture-specific implementations of the FETCH_LINKPTR macro (e.g. the one for x86) attempt to find the linkptr relative to the stack pointer. Therefore, they make assumption about the value of the SP at the point where the FETCH_LINKPTR code is executed. This means that we don't want the C compiler to mess with our SP.

For this purpose, local variables in this function are currently declared using the register storage specifier. Additionally, we need to make sure that a frame pointer is /always/ omitted for this function. On x86 Alpine, the frame pointer is presently not omitted with GCC 13 when using -Os, therefore the tests segfault with -Os on Alpine.

Fixes #52

nmeum avatar Feb 09 '24 23:02 nmeum

Looks ok to me!

kaniini avatar Feb 09 '24 23:02 kaniini