This is needed because in libucontext.h we include "libucontext/bits.h".
We therefore need to have bits.h in somepath/libucontext/bits.h. In the
Makefile, somepath/freestanding/bits.h was copied to the right path but
in the meson build system, the include copy happens at the end.
The Makefile on ARMv7l devices (e.g. Raspberry Pi 400 running the
stock Raspbian distro) was failing to deduct the architecture and
empty libraries were being built as a result. Building with Meson
works fine; only building with make generated empty libraries.
Add an override for armv7l -> arm in the Makefile to address this.
This helps to use OE specific linker flags and fixes
do_package_qa: QA Issue: No GNU_HASH in the ELF binary
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
getcontext cannot be correctly implemented in C.
If this calls another function, as it does to call syscall, it needs to
first spill its return address to the stack. If, after getcontext returns,
its caller then calls other functions, this saved return address can be
clobbered. When the context saved by getcontext is later restored, the
(now clobbered) return address will be reloaded from the stack, and the
second return from getcontext will return to the wrong location.
Because the powerpc swapcontext syscall allows either the old context or
new context pointers to be null, it is usable for implementing all of
get/set/swapcontext.
We therefore rewrite swapcontext in assembly, and get/setcontext as simple
assembly function wrappers around swapcontext.
The one piece we keep in C is the code to check the return value of the
system call and to set errno. This code was actually unnecessary before --
libc does this within syscall. However, now that the system call is made
directly in assembly, bypassing libc, it is truly necessary. Because errno
is thread-local and the details of how to set it can vary by libc, this
code remains written in C.