kaniini / libucontext

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

Add ARM hard-float support #40

Closed rlcamp closed 2 years ago

rlcamp commented 2 years ago

This adds conditional saving and restoring of the VFP registers to the 32 bit ARM target, as required by the hard-float ABI and assumed by newer compilers even in non-floating-point applications. The decision to save FP state is made by querying getauxval(AT_HWCAP) within libucontext_getcontext(). It can be disabled by specifying FORCE_SOFT_FLOAT=yes at compile time, or made unconditional by specifying FORCE_HARD_FLOAT=yes, which should allow it to work on bare metal or when getauxval() is otherwise unavailable.

stefson commented 2 years ago

please make sure not to break compile for musl unintentionally; it doesn't have getcontext:

Legacy functions operating on ucontext_t (getcontext, setcontext, makecontext, swapcontext) are not implemented. They are no longer part of POSIX. 

(quoted from open issues at musl-libc.org)

I'm happy to test the patch for that case if you can't, but give me precise instructions please.

rlcamp commented 2 years ago

please make sure not to break compile for musl unintentionally; it doesn't have getcontext

Updated above comment to clarify that the state is set by libucontext_getcontext(), without any expectation that libc has provided one.

kaniini commented 2 years ago

@stefson writes:

please make sure not to break compile for musl unintentionally; it doesn't have getcontext

Please do not assume that the contributors to this repository are incompetent and that the maintainer (me) would merge anything that would break musl. If you do not drop this attitude, you will be banned from this repo. It is your one and only warning.

stefson commented 2 years ago

oh dear