Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Mar 11, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

Kojoley and others added 11 commits June 14, 2023 16:57
Fixes cross-compilation abi and binformat detection.
`abi` and `binary-format` are now optional but can be used
to override autodetection.
Suppressing -Wsign-conversion warnings
Without this test_fcontext.cpp fails on OpenBSD with a not-on-stack OS error.
This implements the required asm functions for sparc64_sysv_elf and
was tested on an OpenBSD/sparc64 system.

Jump_fcontext uses an extra C call frame to store the frame-pointer and
return address. Because of this the code is simply a save (to new reg
window), then forcing a window flush and finally switch stack and restore
from there.

Since jump_fcontext() uses a register window and stack frame, make_fcontext()
reserves two call frames on the stack (one for jump_fcontext() and the other
for the callback function).

OpenBSD/sparc64 uses stackghost which prevents userland from overriding the
return-address on the stack. Because of this make_fcontext() uses an extra
trampoline to implement the _exit(0) call if the callback returns.

All tests pass with this on OpenBSD/sparc64 (also the tests for fiber,
coroutine and coroutine2).
Implement the fcontext asm for sparc64
Add the BOOST_CONTEXT_USE_MAP_STACK logic to test_fcontext.cpp
@pull pull bot added the ⤵️ pull label Mar 11, 2024
grafikrobot and others added 18 commits March 11, 2024 08:31
This implements the required asm functions for sparc64_sysv_elf and
was tested on an OpenBSD/sparc64 system.

Jump_fcontext uses an extra C call frame to store the frame-pointer and
return address. Because of this the code is simply a save (to new reg
window), then forcing a window flush and finally switch stack and restore
from there.

Since jump_fcontext() uses a register window and stack frame, make_fcontext()
reserves two call frames on the stack (one for jump_fcontext() and the other
for the callback function).

OpenBSD/sparc64 uses stackghost which prevents userland from overriding the
return-address on the stack. Because of this make_fcontext() uses an extra
trampoline to implement the _exit(0) call if the callback returns.

All tests pass with this on OpenBSD/sparc64 (also the tests for fiber,
coroutine and coroutine2).
Without this test_fcontext.cpp fails on OpenBSD with a not-on-stack OS error.
olk and others added 30 commits May 2, 2025 06:49
As an alternative msvc compiler the clang-win toolset needs the same seh flags.
Fix the symbol names used for .size
Fix building with clang-win 32 bit.
fix build of ontop_sparc64_sysv_elf_gas.S
restore exception state after destruction of fiber
Compiling on CYGWIN prints this error:

[  4%] Building ASM-ATT object libs/context/CMakeFiles/boost_context.dir/src/asm/make_x86_64_sysv_elf_gas.S.o
/usr/bin/as: unrecognized option `-x'
make[2]: *** [libs/context/CMakeFiles/boost_context.dir/build.make:78: libs/context/CMakeFiles/boost_context.dir/src/asm/make_x86_64_sysv_elf_gas.S.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3961: libs/context/CMakeFiles/boost_context.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

This PR fixes the right assembly sources to build because sysv and elf are nonsense on CYGWIN.
After this patch, it correctly searches make_x86_64_ms_pe_gas.asm, although it still raises an error because unrecognized -x option.
[CMAKE] CYGWIN: set correct binfmt and abi
CMake: Set correct assembler for MSVC ARM targets
…LF/GAS)

The AArch64 fcontext trampolines (jump_fcontext, make_fcontext, ontop_fcontext)
are indirect-entry-points. On BTI-enforcing systems they must begin with a BTI
or the first resume can trap with SIGILL.

Insert `bti c` (hint #34) at each entry under `__ARM_FEATURE_BTI_DEFAULT`, and
emit `GNU_PROPERTY_AARCH64_FEATURE_1_BTI` from each AArch64 assembly file so
linkers map the DSO with PROT_BTI without requiring -z force-bti.

Scope: ELF/GAS AArch64 trampolines only; +4 bytes per entry

Fixes #308
[AArch64][BTI] Add BTI hint + GNU property to fcontext trampolines
MSVC armasm doesn't support /nologo, /quiet etc. so let's just not apply
any options period.

Signed-off-by: crueter <crueter@eden-emu.dev>
Currently we do not have fcontext related ASM files for Windows ARM64.
So we can use winfib context-impl only for Windows ARM64.

Fixes issue : boostorg/boost#1070
Related to PR: boostorg/boost#1077
[cmake] don't apply assembler options to armasm
…-PowerPC

CMakeLists: improve detection of PowerPC architectures
Renamed forced_unwind struct to fiber_forced_unwind in fiber_ucontext
Don't default to ucontext on cygwin.
Add information to .eh_frame ELF secion about make_fcontext function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.