2
0
mirror of https://github.com/boostorg/context.git synced 2026-02-22 03:12:23 +00:00
Commit Graph

894 Commits

Author SHA1 Message Date
Oliver Kowalke
575dc2b7be Merge pull request #140 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-06-28 17:05:44 +02:00
Oliver Kowalke
8b66a6ab30 -fsplit-stack flag with GCC 2020-06-26 17:50:15 +02:00
Oliver Kowalke
a5b889c0e0 Merge pull request #144 from EGuesnet/split-stack-flag
-fsplit-stack flag with GCC
2020-06-26 07:12:53 +02:00
EGuesnet
8d1c3fbe19 Update Jamfile.v2 2020-06-25 08:46:02 +02:00
EGuesnet
a30c251fcf split-stack flag for GCC
-fsplit-stack flag  available only on Linux for GCC
2020-06-24 10:46:39 +02:00
EGuesnet
5c0adf0b84 split-stack flag for GCC
-fsplit-stack flag  available only on Linux for GCC
2020-06-24 10:45:44 +02:00
Edward Diener
2dbaa73de2 Setup fpr Embarcadero bcc64 64-bit assembler, the Embarcadero 32-bit assembler, and the Bprland 32-bit assembler. The syntactical difference between the Embarcqadero 32-bit assembler and the Borland 32-bit assembler is simply that the embarcadero toolset uses clang-based command lines, while the bporland toolset uses bcc32 based command lines. Otherwise both use tasm32 to assemble assembly files. 2020-05-13 18:58:37 -04:00
Edward Diener
6f050b7f80 Corrected inline definitions. 2020-04-25 00:55:19 -04:00
Edward Diener
d7f002a0c7 Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero. 2020-04-24 18:59:06 -04:00
Edward Diener
550c6d9566 Merge branch 'develop' of https://github.com/boostorg/context into develop 2020-04-24 16:29:06 -04:00
Oliver Kowalke
55dd7ebb52 Merge pull request #135 from Romain-Geissler-1A/develop
Fix gcc -Wunused-variable argument when compiling with -DNDEBUG (and …
2020-04-24 10:56:44 +02:00
Romain Geissler
cf91742a65 Fix gcc -Wunused-variable argument when compiling with -DNDEBUG (and without -DBOOST_DISABLE_ASSERT). 2020-04-03 20:08:16 +00:00
Edward Diener
2cb9300bd0 Merge branch 'develop' of https://github.com/boostorg/context into develop 2020-03-21 21:09:26 -04:00
Oliver Kowalke
7c481a8fb6 Merge pull request #133 from Andreas-Krebbel/ibmz_fix
IBM Z: Fix fcontext routines
boost-1.73.0.beta1 boost-1.73.0
2020-02-21 09:59:21 +01:00
Andreas Krebbel
e0ba57928d IBM Z: Fix fcontext routines 2020-02-21 08:47:46 +01:00
Oliver Kowalke
7ada7aa498 Merge pull request #132 from wzssyqa/align-3
mips64/n64: .align 3
2019-12-26 21:43:56 +01:00
Oliver Kowalke
668ef8514e Merge pull request #131 from wzssyqa/osplat
Use OSPLAT MIPS32/MIPS64 to set different ABI
2019-12-26 21:43:26 +01:00
YunQiang Su
e115983fdf mips64/n64: .align 3
The right align for mips64/n64 is 3 instead of 2.
2019-12-18 03:48:43 -08:00
YunQiang Su
19f2351124 Use OSPLAT MIPS32/MIPS64 to set different ABI
We should set abi for 64bit as n64, and 32bit for o32.
This patch depends on the patch of boost/build.
2019-12-18 03:33:18 -08:00
Oliver Kowalke
e77e4d48af Merge pull request #129 from andreas-schwab/develop
Fix non-PIC in RISC-V assembly
2019-12-08 16:54:37 +01:00
Edward Diener
3514c20d1c Merge branch 'develop' of https://github.com/boostorg/context into develop 2019-12-08 10:26:55 -05:00
Andreas Schwab
e86c66714c Fix non-PIC in RISC-V assembly
Since this ends up in a shared library we should use a PLT call.  Also,
the finish label is local, so we can use lla instead of la.
2019-12-06 22:49:43 +01:00
Oliver Kowalke
0e2c67e1e9 Merge pull request #128 from ericastor/develop
Mark 32-bit GNU assembly files targeting Windows as safeseh compatible
2019-11-28 07:37:09 +01:00
Eric Astor
bebf903239 Mark 32-bit GNU assembly files targeting Windows as /safeseh linking compatible.
We set the LSB of the magic symbol @feat.00 to 1.

This is used to communicate from the compiler to the linker, and specifically to express that the object file has opted into "safeseh"; any SEH handlers used in this file must be listed in the .sxdata section.

Since we don't have any SEH handlers in these files, this is trivially satisfied.

Reference: the PE-COFF specification, https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-sxdata-section
2019-11-27 22:30:46 -05:00
Oliver Kowalke
1954f1843b Merge pull request #127 from ericastor/develop
Fix exports for 32-bit GNU assembler files targeting Windows.
2019-11-22 22:39:29 +01:00
Eric Astor
85783e8cbb Fix exports for 32-bit GNU assembler files targeting Windows.
The incorrect exports can cause linker issues (at least when using LLVM's lld-link) claiming that these primitives are not available.
2019-11-22 11:08:41 -05:00
Oliver Kowalke
bd493f77d8 Merge pull request #122 from janisozaur/patch-1
Fix compilation with MSVC for ARM
boost-1.72.0.beta1 boost-1.72.0
2019-10-23 11:34:13 +02:00
Oliver Kowalke
70fd9b6b62 Merge pull request #123 from kernigh/kernigh-ppc32-3
Fix ppc32 on Linux musl, NetBSD, OpenBSD; fixes #120
2019-10-23 11:19:54 +02:00
George Koehler
df8fb6b528 Fix ppc32 on Linux musl, NetBSD, OpenBSD; fixes #120
This fixes fcontext on my PowerBook G4 running Void Linux
ppc-musl-20190901, NetBSD/macppc 8.1, or OpenBSD/macppc 6.6-current,
all with g++.  These systems use fcontext for *ppc32_sysv_elf*
(PowerPC 32-bit System V ELF).  The assembly code was wrong for BSD
and crashing on Linux musl.

Linux returns a transfer_t in memory (through a hidden pointer in R3),
but other systems (at least NetBSD and OpenBSD) return a transfer_t in
registers R3:R4.  jump_fcontext() and ontop_fcontext() were always
using the hidden pointer.  Add checks for `#ifdef__linux__`; start
using R3:R4 on other systems.

make_fcontext() was calling _exit(0) through the insecure BSS PLT.
Set R30 to use the secure PLT.  This prevents a crash when musl's
ld.so loads the executable; musl seems to require the secure PLT.

Fix ontop_fcontext() to restore the hidden pointer on Linux.  It was
passing the wrong context's hidden pointer to the ontop-function fn(),
so fn() returned a transfer_t to the wrong stack.  When fn() was
context_exit() in <boost/context/continuation_fcontext.hpp>, it freed
the old stack, then returned `transfer_t{ nullptr, nullptr }` to free
memory.  This crashed on Linux musl.

Now that ontop_fcontext() restores the hidden pointer, it must stop
abusing the same pointer to pass a transfer_t argument to fn().  Add a
new ontop_fcontext_tail() in C++, which takes arguments in registers
and allocates a transfer_t.  The code is in C++ so it can free the
transfer_t argument if fn() throws a C++ exception.

Rearrange the context frame to shrink it from 244 to 240 bytes.  This
fixes the stack alignment: the ABI requires R1 % 16 == 0, and
make_fcontext() respects this, but jump_fcontext() was adding 244 to
R1, so the new context ran with a misaligned stack (244 % 16 == 4).

Remove R13 from the context frame, so new contexts stop loading R13
with garbage.  The ABI uses R13 to point to the executable's small
data, so R13 should have the same value in every context.

Add the backchain to the context frame; make room by moving LR to the
caller's frame.  Order CR, R14 to R31, F14 to F31 at the frame's end,
as is typical for this ABI.  Provide 8-byte alignment for FPSCR and
F14 to F31, to avoid a misalignment penalty.
2019-10-19 14:06:24 -04:00
Michał Janiszewski
0386f0e6fd Fix compilation with MSVC for ARM
Much like https://github.com/boostorg/type_traits/pull/106, only allow
x86-specific intrinsics when targetting x86-like architectures.
2019-10-16 22:45:12 +02:00
Oliver Kowalke
a4bdc60ed3 Merge pull request #121 from kernigh/kernigh-openbsd
Use mmap(2) MAP_STACK to allocate stacks on OpenBSD
2019-10-04 06:28:04 +02:00
George Koehler
7e14ab9e45 Use mmap(2) MAP_STACK to allocate stacks on OpenBSD
Since OpenBSD 6.4 (https://www.openbsd.org/64.html), the stack pointer
must point to MAP_STACK memory, or the kernel may kill the process
with a signal.  All stack allocators must pass MAP_STACK to mmap(2).

Define BOOST_CONTEXT_USE_MAP_STACK on OpenBSD, and don't define it on
other systems.  This doesn't check for old versions of OpenBSD without
MAP_STACK; but OpenBSD has stopped maintaining versions before 6.4.

If BOOST_CONTEXT_USE_MAP_STACK is defined, then cause the stack
allocators to pass MAP_STACK to mmap(2):

 - fixedsize_stack uses mmap/munmap instead of malloc/free.  This
   comes from a patch in OpenBSD Ports.

 - protected_fixedsize_stack adds MAP_STACK to the mmap flags (as it
   does in OpenBSD Ports).  Assume that systems with MAP_STACK also
   have MAP_ANON; this is true on OpenBSD.  Delete POSIX comment,
   because I can't find MAP_ANON nor MAP_ANONYMOUS in POSIX, so these
   mmap calls don't conform to POSIX.

 - pooled_fixedsize_stack can't call munmap, because the pool's free
   doesn't know the allocation's size.  Instead use posix_memalign to
   allocate memory, then mmap to replace the pages with MAP_STACK
   pages, so the pool's free may call std::free.

OpenBSD has no <ucontext.h>, so edit test/Jamfile.v2 to skip ucontext
tests on OpenBSD.

This commit and https://github.com/boostorg/test/pull/231 causes
libs/context/test `b2 full` to pass on OpenBSD 6.5 for 64-bit x86.
`b2 fc` fails because the allocator in test_fcontext.cpp does not use
MAP_STACK.  The tests seem not to cover pooled_fixedsize_stack nor
protected_fixedsize_stack, but they still pass when I temporarily hack
callcc to use those allocators instead of fixedsize_stack.
2019-10-03 20:47:36 -04:00
Edward Diener
0535ab2267 Merge branch 'develop' of https://github.com/boostorg/context into develop 2019-10-02 21:57:59 -04:00
Oliver Kowalke
14b4f45187 docu: sanitizer support 2019-10-02 08:17:24 +02:00
Oliver Kowalke
ff08ccbbfa Merge pull request #119 from nealef/s390x
Optimize s390x instructions
2019-09-21 08:57:21 +02:00
Neale Ferguson
b90917eaed Optimize s390x instructions 2019-09-20 13:23:19 -04:00
Edward Diener
faa1074408 Merge branch 'develop' of https://github.com/boostorg/context into develop 2019-09-19 16:32:24 -04:00
Oliver Kowalke
36a81359f0 docu: update architectures 2019-09-12 17:38:19 +02:00
Oliver Kowalke
ecb4e398a7 Merge pull request #117 from Naveenaidu/add-support-s390x
S390x: Add Support for s390x arch
2019-09-06 19:20:12 +02:00
Naveenaidu
adecfdc88c S390x: Add Support for s390x arch 2019-09-06 20:08:10 +05:30
Oliver Kowalke
0c754f90c5 execution_context removed 2019-08-29 13:42:03 +02:00
Edward Diener
00e3ad63ce Merge branch 'develop' of https://github.com/boostorg/context into develop 2019-08-19 19:43:14 -04:00
Oliver Kowalke
227fbd01f2 documentation updated boost-1.71.0 2019-08-11 20:04:40 +02:00
Oliver Kowalke
cba547ba5d Merge pull request #112 from boostorg/revert-111-s390x-debug
Revert "S390x Implementation: WIP"
2019-08-03 08:33:36 +02:00
Oliver Kowalke
9c772a7830 Revert "S390x Implementation: WIP" 2019-08-03 08:33:17 +02:00
Oliver Kowalke
26aee14910 Merge pull request #111 from Naveenaidu/s390x-debug
S390x Implementation: WIP
2019-08-03 08:25:57 +02:00
Naveenaidu
cc71b90db6 Jamfile.v2: Fix binary format s390x 2019-08-03 09:27:55 +05:30
Naveenaidu
4d0cd2a6ce jump_s390x_sys_elf: Add jump_context for s390x 2019-07-31 18:51:49 +05:30
Naveenaidu
99a29956f3 s390x_make_context: Fix stack frame 2019-07-31 18:50:38 +05:30
Naveenaidu
81e26a1618 make_context: Add s390x arch 2019-07-22 22:53:43 +05:30