kaniini / libucontext

ucontext implementation featuring glibc-compatible ABI
Other
102 stars 41 forks source link

common-trampoline: Ensure omission of frame-pointer #60

Closed nmeum closed 1 month ago

nmeum commented 7 months ago

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

kaniini commented 7 months ago

Looks ok to me!