Commit 9cefeea7b10 for php.net

commit 9cefeea7b105b0e8153958c3908ef063cad6e391
Author: kn1g78 <huan9d0w@gmail.com>
Date:   Sat Jul 4 08:54:57 2026 +0800

    Sync Boost.Context assembly with 1.91.0

    Closes GH-22584

diff --git a/.github/scripts/download-bundled/boost-context.sh b/.github/scripts/download-bundled/boost-context.sh
index b1fd8708b85..02febff73c3 100755
--- a/.github/scripts/download-bundled/boost-context.sh
+++ b/.github/scripts/download-bundled/boost-context.sh
@@ -5,7 +5,7 @@ cd "$(dirname "$0")/../../.."
 tmp_dir=/tmp/php-src-download-bundled/boost-context
 rm -rf "$tmp_dir"

-revision=refs/tags/boost-1.86.0
+revision=refs/tags/boost-1.91.0

 git clone --depth 1 --revision="$revision" https://github.com/boostorg/context.git "$tmp_dir"

@@ -16,12 +16,14 @@ cd Zend/asm

 # remove unneeded files
 rm jump_arm_aapcs_pe_armasm.asm
+rm jump_arm64_aapcs_pe_armclang.S
 rm jump_i386_ms_pe_clang_gas.S
 rm jump_i386_ms_pe_gas.asm
 rm jump_i386_x86_64_sysv_macho_gas.S
 rm jump_ppc32_ppc64_sysv_macho_gas.S
 rm jump_x86_64_ms_pe_clang_gas.S
 rm make_arm_aapcs_pe_armasm.asm
+rm make_arm64_aapcs_pe_armclang.S
 rm make_i386_ms_pe_clang_gas.S
 rm make_i386_ms_pe_gas.asm
 rm make_i386_x86_64_sysv_macho_gas.S
diff --git a/NEWS b/NEWS
index e476e2b8303..77ea35389d5 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 8.6.0alpha2

+- Core:
+  . Sync Boost.Context assembly with 1.91.0. (kn1g78)
+
 - DBA:
   . Fixed OOB read on malformed length field in dba flatfile handler. (alhudz)

diff --git a/Zend/asm/jump_arm64_aapcs_elf_gas.S b/Zend/asm/jump_arm64_aapcs_elf_gas.S
index cefd1830d71..b8abb2ef6bc 100644
--- a/Zend/asm/jump_arm64_aapcs_elf_gas.S
+++ b/Zend/asm/jump_arm64_aapcs_elf_gas.S
@@ -53,10 +53,29 @@

 .file "jump_arm64_aapcs_elf_gas.S"
 .text
+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
+/* Mark this object as requiring BTI, enabling the linker to set BTI on the output */
+    .pushsection .note.gnu.property, "a", %note
+    .p2align 3
+    .long 4                      /* namesz */
+    .long 16                     /* descsz (16 bytes) */
+    .long 5                      /* type = NT_GNU_PROPERTY_TYPE_0 */
+    .asciz "GNU"
+    .p2align 3
+    .long 0xc0000000             /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
+    .long 4                      /* datasz = 4 */
+    .long 1                      /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
+    .long 0                      /* pad to 8-byte alignment */
+    .popsection
+#endif
 .align  2
 .global jump_fcontext
+.hidden jump_fcontext
 .type   jump_fcontext, %function
 jump_fcontext:
+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
+    hint    #34                    /* bti c: valid indirect-entry target */
+#endif
     # prepare stack for GP + FPU
     sub  sp, sp, #0xb0

diff --git a/Zend/asm/jump_arm64_aapcs_macho_gas.S b/Zend/asm/jump_arm64_aapcs_macho_gas.S
index 31738f74531..12cc0215868 100644
--- a/Zend/asm/jump_arm64_aapcs_macho_gas.S
+++ b/Zend/asm/jump_arm64_aapcs_macho_gas.S
@@ -52,6 +52,7 @@
  *******************************************************/

 .text
+.private_extern _jump_fcontext
 .globl _jump_fcontext
 .balign 16
 _jump_fcontext:
diff --git a/Zend/asm/jump_arm64_aapcs_pe_armasm.asm b/Zend/asm/jump_arm64_aapcs_pe_armasm.asm
index 3100243d68d..afb6d2b2e70 100644
--- a/Zend/asm/jump_arm64_aapcs_pe_armasm.asm
+++ b/Zend/asm/jump_arm64_aapcs_pe_armasm.asm
@@ -45,7 +45,7 @@
 ;*  -------------------------------------------------  *
 ;*  | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc|  *
 ;*  -------------------------------------------------  *
-;*  | fiber data|   base    |   limit   |  dealloc  |  *
+;*  |   base    |   limit   |  dealloc  | fiber data|  *
 ;*  -------------------------------------------------  *
 ;*  -------------------------------------------------  *
 ;*  |  48 |  49 |  50 | 51  |           |           |  *
@@ -130,4 +130,4 @@ jump_fcontext proc

     ret x4
     ENDP
-    END
\ No newline at end of file
+    END
diff --git a/Zend/asm/jump_arm_aapcs_elf_gas.S b/Zend/asm/jump_arm_aapcs_elf_gas.S
index 86efe9d8214..4415a541fd3 100644
--- a/Zend/asm/jump_arm_aapcs_elf_gas.S
+++ b/Zend/asm/jump_arm_aapcs_elf_gas.S
@@ -41,6 +41,7 @@
 .file "jump_arm_aapcs_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 2
 .type jump_fcontext,%function
 .syntax unified
@@ -48,8 +49,38 @@ jump_fcontext:
     @ save LR as PC
     push {lr}
     @ save hidden,V1-V8,LR
+
+    #if __ARM_ARCH >= 7
+
     push {a1,v1-v8,lr}

+    #else
+
+    sub  sp, #40
+
+    str a1, [sp, #0]
+    str v1, [sp, #4]
+    str v2, [sp, #8]
+    str v3, [sp, #12]
+    str v4, [sp, #16]
+
+    mov v4, v5
+    str v4, [sp, #20]
+
+    mov v4, v6
+    str v4, [sp, #24]
+
+    mov v4, v7
+    str v4, [sp, #28]
+
+    mov v4, v8
+    str v4, [sp, #32]
+
+    mov v4, lr
+    str v4, [sp, #36]
+
+    #endif
+
     @ prepare stack for FPU
     sub  sp, sp, #64
 #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
@@ -71,7 +102,34 @@ jump_fcontext:
     add  sp, sp, #64

     @ restore hidden,V1-V8,LR
+    #if __ARM_ARCH >= 7
     pop {a4,v1-v8,lr}
+    #else
+
+    ldr v4, [sp, #20]
+    mov v5, v4
+
+    ldr v4, [sp, #24]
+    mov v6, v4
+
+    ldr v4, [sp, #28]
+    mov v7, v4
+
+    ldr v4, [sp, #32]
+    mov v8, v4
+
+    ldr v4, [sp, #36]
+    mov lr, v4
+
+    ldr a4, [sp, #0]
+    ldr v1, [sp, #4]
+    ldr v2, [sp, #8]
+    ldr v3, [sp, #12]
+    ldr v4, [sp, #16]
+
+    add sp, #40
+
+    #endif

     @ return transfer_t from jump
     str  a1, [a4, #0]
diff --git a/Zend/asm/jump_arm_aapcs_macho_gas.S b/Zend/asm/jump_arm_aapcs_macho_gas.S
index 077c36409e8..44e7f2a4227 100644
--- a/Zend/asm/jump_arm_aapcs_macho_gas.S
+++ b/Zend/asm/jump_arm_aapcs_macho_gas.S
@@ -39,6 +39,7 @@
  *******************************************************/

 .text
+.private_extern _jump_fcontext
 .globl _jump_fcontext
 .align 2
 _jump_fcontext:
diff --git a/Zend/asm/jump_i386_ms_pe_masm.asm b/Zend/asm/jump_i386_ms_pe_masm.asm
index 7a9e848f1c3..a0450d0532f 100644
--- a/Zend/asm/jump_i386_ms_pe_masm.asm
+++ b/Zend/asm/jump_i386_ms_pe_masm.asm
@@ -55,17 +55,17 @@ ENDIF
     mov  eax, [edx]
     mov  [esp+018h], eax

-    mov  [esp+01ch], edi  ; save EDI
-    mov  [esp+020h], esi  ; save ESI
-    mov  [esp+024h], ebx  ; save EBX
-    mov  [esp+028h], ebp  ; save EBP
+    mov  [esp+01ch], edi  ; save EDI
+    mov  [esp+020h], esi  ; save ESI
+    mov  [esp+024h], ebx  ; save EBX
+    mov  [esp+028h], ebp  ; save EBP

     ; store ESP (pointing to context-data) in EAX
     mov  eax, esp

     ; firstarg of jump_fcontext() == fcontext to jump to
     mov  ecx, [esp+030h]
-
+
     ; restore ESP (pointing to context-data) from ECX
     mov  esp, ecx

@@ -98,10 +98,10 @@ ENDIF

     mov  ecx, [esp+02ch]  ; restore EIP

-    mov  edi, [esp+01ch]  ; restore EDI
-    mov  esi, [esp+020h]  ; restore ESI
-    mov  ebx, [esp+024h]  ; restore EBX
-    mov  ebp, [esp+028h]  ; restore EBP
+    mov  edi, [esp+01ch]  ; restore EDI
+    mov  esi, [esp+020h]  ; restore ESI
+    mov  ebx, [esp+024h]  ; restore EBX
+    mov  ebp, [esp+028h]  ; restore EBP

     ; prepare stack
     lea  esp, [esp+030h]
diff --git a/Zend/asm/jump_i386_sysv_elf_gas.S b/Zend/asm/jump_i386_sysv_elf_gas.S
index ed83717ce2b..d00ac4fffd4 100644
--- a/Zend/asm/jump_i386_sysv_elf_gas.S
+++ b/Zend/asm/jump_i386_sysv_elf_gas.S
@@ -31,6 +31,7 @@
 .file "jump_i386_sysv_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 2
 .type jump_fcontext,@function
 jump_fcontext:
diff --git a/Zend/asm/jump_i386_sysv_macho_gas.S b/Zend/asm/jump_i386_sysv_macho_gas.S
index 8ab7c6f29c6..4cae3252d17 100644
--- a/Zend/asm/jump_i386_sysv_macho_gas.S
+++ b/Zend/asm/jump_i386_sysv_macho_gas.S
@@ -25,6 +25,7 @@
  ****************************************************************************************/

 .text
+.private_extern _jump_fcontext
 .globl _jump_fcontext
 .align 2
 _jump_fcontext:
@@ -54,8 +55,8 @@ _jump_fcontext:

     /* return parent fcontext_t */
     movl  %ecx, %eax
-    /* returned data is stored in EDX */
-
+    /* returned data is stored in EDX */
+
     movl  0x18(%esp), %ecx  /* restore EIP */

 #if !defined(BOOST_USE_TSX)
diff --git a/Zend/asm/jump_loongarch64_sysv_elf_gas.S b/Zend/asm/jump_loongarch64_sysv_elf_gas.S
index 74c081e07fa..6f99e719ec0 100644
--- a/Zend/asm/jump_loongarch64_sysv_elf_gas.S
+++ b/Zend/asm/jump_loongarch64_sysv_elf_gas.S
@@ -41,6 +41,7 @@
 .file "jump_loongarch64_sysv_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 2
 .type jump_fcontext,@function
 jump_fcontext:
diff --git a/Zend/asm/jump_mips32_o32_elf_gas.S b/Zend/asm/jump_mips32_o32_elf_gas.S
index f2b8034d8c5..38d22d26f6d 100644
--- a/Zend/asm/jump_mips32_o32_elf_gas.S
+++ b/Zend/asm/jump_mips32_o32_elf_gas.S
@@ -41,6 +41,7 @@
 .file "jump_mips32_o32_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 2
 .type jump_fcontext,@function
 .ent jump_fcontext
@@ -102,13 +103,13 @@ jump_fcontext:

     # adjust stack
     addiu $sp, $sp, 96
-
+
     # return transfer_t from jump
     sw  $a0, ($v0)  # fctx of transfer_t
     sw  $a2, 4($v0) # data of transfer_t
     # pass transfer_t as first arg in context function
     # A0 == fctx, A1 == data
-    move  $a1, $a2
+    move  $a1, $a2

     # jump to context
     jr  $t9
diff --git a/Zend/asm/jump_mips64_n64_elf_gas.S b/Zend/asm/jump_mips64_n64_elf_gas.S
index e338912bb6e..60027fe6173 100644
--- a/Zend/asm/jump_mips64_n64_elf_gas.S
+++ b/Zend/asm/jump_mips64_n64_elf_gas.S
@@ -48,6 +48,7 @@
 .file "jump_mips64_n64_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 3
 .type jump_fcontext,@function
 .ent jump_fcontext
diff --git a/Zend/asm/jump_ppc32_sysv_elf_gas.S b/Zend/asm/jump_ppc32_sysv_elf_gas.S
index 48e09c935e0..e3133664006 100644
--- a/Zend/asm/jump_ppc32_sysv_elf_gas.S
+++ b/Zend/asm/jump_ppc32_sysv_elf_gas.S
@@ -53,6 +53,7 @@
 .file "jump_ppc32_sysv_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .align 2
 .type jump_fcontext,@function
 jump_fcontext:
diff --git a/Zend/asm/jump_ppc32_sysv_macho_gas.S b/Zend/asm/jump_ppc32_sysv_macho_gas.S
index fef90c295f8..c2a2061e877 100644
--- a/Zend/asm/jump_ppc32_sysv_macho_gas.S
+++ b/Zend/asm/jump_ppc32_sysv_macho_gas.S
@@ -68,12 +68,13 @@
  *  -------------------------------------------------  *
  *  | 256 |                                         |  *
  *  -------------------------------------------------  *
- *  | DATA|                                         |  *
+ *  | DATA|                                         |  *
  *  -------------------------------------------------  *
  *                                                     *
  *******************************************************/

 .text
+.private_extern _jump_fcontext
 .globl _jump_fcontext
 .align 2
 _jump_fcontext:
@@ -193,7 +194,7 @@ _jump_fcontext:
     ; adjust stack
     addi  r1, r1, 244

-    ; return transfer_t
+    ; return transfer_t
     stw  r6, 0(r3)
     stw  r5, 4(r3)

diff --git a/Zend/asm/jump_ppc64_sysv_elf_gas.S b/Zend/asm/jump_ppc64_sysv_elf_gas.S
index 28907db32b8..debeb346640 100644
--- a/Zend/asm/jump_ppc64_sysv_elf_gas.S
+++ b/Zend/asm/jump_ppc64_sysv_elf_gas.S
@@ -68,6 +68,7 @@

 .file "jump_ppc64_sysv_elf_gas.S"
 .globl jump_fcontext
+.hidden jump_fcontext
 #if _CALL_ELF == 2
 	.text
 	.align 2
@@ -97,7 +98,7 @@ jump_fcontext:
 # endif
 #endif
     # reserve space on stack
-    subi  %r1, %r1, 184
+    subi  %r1, %r1, 200

 #if _CALL_ELF != 2
     std  %r2,  0(%r1)  # save TOC
@@ -133,6 +134,10 @@ jump_fcontext:
     # save LR as PC
     std   %r0, 176(%r1)

+    # Save VS63
+    li    %r31, 184
+    stvx  %v31, %r1, %r31
+
     # store RSP (pointing to context-data) in R6
     mr  %r6, %r1

@@ -145,6 +150,11 @@ jump_fcontext:

     ld  %r2,  0(%r1)  # restore TOC
 #endif
+
+    # Restore VS63
+    li    %r31, 184
+    lvx   %v31, %r1, %r31
+
     ld  %r14, 8(%r1)  # restore R14
     ld  %r15, 16(%r1)  # restore R15
     ld  %r16, 24(%r1)  # restore R16
@@ -180,7 +190,7 @@ jump_fcontext:
     mtctr  %r12

     # adjust stack
-    addi  %r1, %r1, 184
+    addi  %r1, %r1, 200

 #if _CALL_ELF == 2
     # copy transfer_t into transfer_fn arg registers
diff --git a/Zend/asm/jump_ppc64_sysv_macho_gas.S b/Zend/asm/jump_ppc64_sysv_macho_gas.S
index dcc6c645db6..e4d8944b563 100644
--- a/Zend/asm/jump_ppc64_sysv_macho_gas.S
+++ b/Zend/asm/jump_ppc64_sysv_macho_gas.S
@@ -68,6 +68,7 @@

 .text
 .align 2
+.private_extern _jump_fcontext
 .globl _jump_fcontext

 _jump_fcontext:
diff --git a/Zend/asm/jump_riscv64_sysv_elf_gas.S b/Zend/asm/jump_riscv64_sysv_elf_gas.S
index 5417e5d5e34..879eb7efee6 100644
--- a/Zend/asm/jump_riscv64_sysv_elf_gas.S
+++ b/Zend/asm/jump_riscv64_sysv_elf_gas.S
@@ -61,6 +61,7 @@
 .text
 .align  1
 .global jump_fcontext
+.hidden jump_fcontext
 .type   jump_fcontext, %function
 jump_fcontext:
     # prepare stack for GP + FPU
diff --git a/Zend/asm/jump_s390x_sysv_elf_gas.S b/Zend/asm/jump_s390x_sysv_elf_gas.S
index fa71467756d..59bc58bf370 100644
--- a/Zend/asm/jump_s390x_sysv_elf_gas.S
+++ b/Zend/asm/jump_s390x_sysv_elf_gas.S
@@ -46,6 +46,7 @@
 .text
 .align	8
 .global	jump_fcontext
+.hidden jump_fcontext
 .type	jump_fcontext, @function

 #define ARG_OFFSET         0
diff --git a/Zend/asm/jump_x86_64_sysv_elf_gas.S b/Zend/asm/jump_x86_64_sysv_elf_gas.S
index be264bdc2e2..2eff59a380c 100644
--- a/Zend/asm/jump_x86_64_sysv_elf_gas.S
+++ b/Zend/asm/jump_x86_64_sysv_elf_gas.S
@@ -44,6 +44,7 @@
 .file "jump_x86_64_sysv_elf_gas.S"
 .text
 .globl jump_fcontext
+.hidden jump_fcontext
 .type jump_fcontext,@function
 .align 16
 jump_fcontext:
@@ -67,14 +68,6 @@ jump_fcontext:
     movq  %rbx, 0x30(%rsp)  /* save RBX */
     movq  %rbp, 0x38(%rsp)  /* save RBP */

-#if BOOST_CONTEXT_SHADOW_STACK
-    /* grow the stack to reserve space for shadow stack pointer(SSP) */
-    leaq  -0x8(%rsp), %rsp
-    /* read the current SSP and store it */
-    rdsspq  %rcx
-    movq  %rcx, (%rsp)
-#endif
-
 #if BOOST_CONTEXT_SHADOW_STACK
     /* grow the stack to reserve space for shadow stack pointer(SSP) */
     leaq  -0x8(%rsp), %rsp
diff --git a/Zend/asm/jump_x86_64_sysv_macho_gas.S b/Zend/asm/jump_x86_64_sysv_macho_gas.S
index afc3e5c126f..673daa61dfa 100644
--- a/Zend/asm/jump_x86_64_sysv_macho_gas.S
+++ b/Zend/asm/jump_x86_64_sysv_macho_gas.S
@@ -25,6 +25,7 @@
  ****************************************************************************************/

 .text
+.private_extern _jump_fcontext
 .globl _jump_fcontext
 .align 8
 _jump_fcontext:
diff --git a/Zend/asm/make_arm64_aapcs_elf_gas.S b/Zend/asm/make_arm64_aapcs_elf_gas.S
index 66cfb2da17e..246525402f5 100644
--- a/Zend/asm/make_arm64_aapcs_elf_gas.S
+++ b/Zend/asm/make_arm64_aapcs_elf_gas.S
@@ -53,10 +53,29 @@

 .file "make_arm64_aapcs_elf_gas.S"
 .text
+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
+/* Mark this object as requiring BTI, enabling the linker to set BTI on the output */
+    .pushsection .note.gnu.property, "a", %note
+    .p2align 3
+    .long 4                      /* namesz */
+    .long 16                     /* descsz (16 bytes) */
+    .long 5                      /* type = NT_GNU_PROPERTY_TYPE_0 */
+    .asciz "GNU"
+    .p2align 3
+    .long 0xc0000000             /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
+    .long 4                      /* datasz = 4 */
+    .long 1                      /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
+    .long 0                      /* pad to 8-byte alignment */
+    .popsection
+#endif
 .align  2
 .global make_fcontext
+.hidden make_fcontext
 .type   make_fcontext, %function
 make_fcontext:
+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
+    hint    #34    /* bti c */
+#endif
     # shift address in x0 (allocated stack) to lower 16 byte boundary
     and x0, x0, ~0xF

diff --git a/Zend/asm/make_arm64_aapcs_macho_gas.S b/Zend/asm/make_arm64_aapcs_macho_gas.S
index b30b1e3e5bb..a6a1314c0dc 100644
--- a/Zend/asm/make_arm64_aapcs_macho_gas.S
+++ b/Zend/asm/make_arm64_aapcs_macho_gas.S
@@ -52,6 +52,7 @@
  *******************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 .balign 16

diff --git a/Zend/asm/make_arm64_aapcs_pe_armasm.asm b/Zend/asm/make_arm64_aapcs_pe_armasm.asm
index 50f9b69876b..c384af039fc 100644
--- a/Zend/asm/make_arm64_aapcs_pe_armasm.asm
+++ b/Zend/asm/make_arm64_aapcs_pe_armasm.asm
@@ -73,7 +73,7 @@ make_fcontext proc

     ; save top address of context_stack as 'base'
     str  x3, [x0, #0xa0]
-    ; save bottom address of context-stack as 'limit' and 'dealloction stack'
+    ; save bottom address of context-stack as 'limit' and 'deallocation stack'
     sub  x3, x3, x1
     stp  x3, x3, [x0, #0xa8]
     ; save 0 as 'fiber data'
diff --git a/Zend/asm/make_arm_aapcs_elf_gas.S b/Zend/asm/make_arm_aapcs_elf_gas.S
index 98ae64b43f9..2367c75a6a7 100644
--- a/Zend/asm/make_arm_aapcs_elf_gas.S
+++ b/Zend/asm/make_arm_aapcs_elf_gas.S
@@ -41,26 +41,47 @@
 .file "make_arm_aapcs_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 2
 .type make_fcontext,%function
 .syntax unified
 make_fcontext:
     @ shift address in A1 to lower 16 byte boundary
+
+    #if __ARM_ARCH >= 7
     bic  a1, a1, #15
+    #else
+    lsrs	a1, a1, #4
+    lsls	a1, a1, #4
+    #endif

     @ reserve space for context-data on context-stack
+    #if __ARM_ARCH >= 7
     sub  a1, a1, #124
+    #else
+    subs  a1, #124
+    #endif

     @ third arg of make_fcontext() == address of context-function
     str  a3, [a1, #104]

     @ compute address of returned transfer_t
+    #if __ARM_ARCH >= 7
     add  a2, a1, #108
+    #else
+    mov  a2, a1
+    adds  a2, #108
+    #endif
     mov  a3, a2
     str  a3, [a1, #64]

+
     @ compute abs address of label finish
+    #if __ARM_ARCH >= 7
     adr  a2, finish
+    #else
+    ldr  a2, =finish
+    #endif
     @ save address of finish as return-address for context-function
     @ will be entered after context-function returns
     str  a2, [a1, #100]
@@ -72,7 +93,13 @@ make_fcontext:

 finish:
     @ exit code is zero
+    #if __ARM_ARCH >=7
     mov  a1, #0
+    #else
+    movs	r3, #0
+    movs	r0, r3
+    #endif
+
     @ exit application
     bl  _exit@PLT
 .size make_fcontext,.-make_fcontext
diff --git a/Zend/asm/make_arm_aapcs_macho_gas.S b/Zend/asm/make_arm_aapcs_macho_gas.S
index c909ae9d43a..de934075d24 100644
--- a/Zend/asm/make_arm_aapcs_macho_gas.S
+++ b/Zend/asm/make_arm_aapcs_macho_gas.S
@@ -39,6 +39,7 @@
  *******************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 .align 2
 _make_fcontext:
diff --git a/Zend/asm/make_i386_ms_pe_masm.asm b/Zend/asm/make_i386_ms_pe_masm.asm
index 5246465cb97..3879396390f 100644
--- a/Zend/asm/make_i386_ms_pe_masm.asm
+++ b/Zend/asm/make_i386_ms_pe_masm.asm
@@ -53,7 +53,7 @@ make_fcontext PROC BOOST_CONTEXT_EXPORT
     mov  [eax+014h], ecx
     ; second arg of make_fcontext() == size of context-stack
     mov  edx, [esp+08h]
-    ; negate stack size for LEA instruction (== substraction)
+    ; negate stack size for LEA instruction (== subtraction)
     neg  edx
     ; compute bottom address of context stack (limit)
     lea  ecx, [ecx+edx]
diff --git a/Zend/asm/make_i386_sysv_elf_gas.S b/Zend/asm/make_i386_sysv_elf_gas.S
index c6e0b36558a..992bae019af 100644
--- a/Zend/asm/make_i386_sysv_elf_gas.S
+++ b/Zend/asm/make_i386_sysv_elf_gas.S
@@ -31,6 +31,7 @@
 .file "make_i386_sysv_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 2
 .type make_fcontext,@function
 make_fcontext:
diff --git a/Zend/asm/make_i386_sysv_macho_gas.S b/Zend/asm/make_i386_sysv_macho_gas.S
index 519e406248b..01076129bcf 100644
--- a/Zend/asm/make_i386_sysv_macho_gas.S
+++ b/Zend/asm/make_i386_sysv_macho_gas.S
@@ -25,6 +25,7 @@
  ****************************************************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 .align 2
 _make_fcontext:
@@ -69,7 +70,7 @@ _make_fcontext:
     addl  $finish-2b, %ecx
     /* save address of finish as return-address for context-function */
     /* will be entered after context-function returns */
-    movl  %ecx, 0x14(%eax)
+    movl  %ecx, 0x14(%eax)

     ret /* return pointer to context-data */

diff --git a/Zend/asm/make_loongarch64_sysv_elf_gas.S b/Zend/asm/make_loongarch64_sysv_elf_gas.S
index 55062702f18..a067baded56 100644
--- a/Zend/asm/make_loongarch64_sysv_elf_gas.S
+++ b/Zend/asm/make_loongarch64_sysv_elf_gas.S
@@ -41,6 +41,7 @@
 .file "make_loongarch64_sysv_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 2
 .type make_fcontext,@function
 make_fcontext:
diff --git a/Zend/asm/make_mips32_o32_elf_gas.S b/Zend/asm/make_mips32_o32_elf_gas.S
index 4e11e3d0582..54742f3a8be 100644
--- a/Zend/asm/make_mips32_o32_elf_gas.S
+++ b/Zend/asm/make_mips32_o32_elf_gas.S
@@ -41,6 +41,7 @@
 .file "make_mips32_o32_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 2
 .type make_fcontext,@function
 .ent make_fcontext
diff --git a/Zend/asm/make_mips64_n64_elf_gas.S b/Zend/asm/make_mips64_n64_elf_gas.S
index 7bb30b14dee..c43f2ff368f 100644
--- a/Zend/asm/make_mips64_n64_elf_gas.S
+++ b/Zend/asm/make_mips64_n64_elf_gas.S
@@ -48,6 +48,7 @@
 .file "make_mips64_n64_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 3
 .type make_fcontext,@function
 .ent make_fcontext
@@ -69,7 +70,7 @@ make_fcontext:
     # save global pointer in context-data
     sd  $gp, 136($v0)

-    # psudo instruction compute abs address of label finish based on GP
+    # pseudo instruction compute abs address of label finish based on GP
     dla  $t9, finish

     # save address of finish as return-address for context-function
diff --git a/Zend/asm/make_ppc32_sysv_elf_gas.S b/Zend/asm/make_ppc32_sysv_elf_gas.S
index 9616c4ca9b4..0dd77719354 100644
--- a/Zend/asm/make_ppc32_sysv_elf_gas.S
+++ b/Zend/asm/make_ppc32_sysv_elf_gas.S
@@ -53,6 +53,7 @@
 .file "make_ppc32_sysv_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .align 2
 .type make_fcontext,@function
 make_fcontext:
diff --git a/Zend/asm/make_ppc32_sysv_macho_gas.S b/Zend/asm/make_ppc32_sysv_macho_gas.S
index 1102ee90ef0..75d1c80e526 100644
--- a/Zend/asm/make_ppc32_sysv_macho_gas.S
+++ b/Zend/asm/make_ppc32_sysv_macho_gas.S
@@ -68,12 +68,13 @@
  *  -------------------------------------------------  *
  *  | 256 |                                         |  *
  *  -------------------------------------------------  *
- *  | DATA|                                         |  *
+ *  | DATA|                                         |  *
  *  -------------------------------------------------  *
  *                                                     *
  *******************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 .align 2
 _make_fcontext:
@@ -101,8 +102,8 @@ _make_fcontext:

     ; compute address of returned transfer_t
     addi  r0, r3, 252
-    mr    r4, r0
-    stw   r4, 228(r3)
+    mr    r4, r0
+    stw   r4, 228(r3)

     ; load LR
     mflr  r0
diff --git a/Zend/asm/make_ppc64_sysv_elf_gas.S b/Zend/asm/make_ppc64_sysv_elf_gas.S
index c4d7ee59826..f513d3639ea 100644
--- a/Zend/asm/make_ppc64_sysv_elf_gas.S
+++ b/Zend/asm/make_ppc64_sysv_elf_gas.S
@@ -68,6 +68,7 @@

 .file "make_ppc64_sysv_elf_gas.S"
 .globl make_fcontext
+.hidden make_fcontext
 #if _CALL_ELF == 2
 	.text
 	.align 2
diff --git a/Zend/asm/make_ppc64_sysv_macho_gas.S b/Zend/asm/make_ppc64_sysv_macho_gas.S
index dd7bf2c5c0c..d8cdd2d080d 100644
--- a/Zend/asm/make_ppc64_sysv_macho_gas.S
+++ b/Zend/asm/make_ppc64_sysv_macho_gas.S
@@ -67,6 +67,7 @@
  *******************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 _make_fcontext:
     ; save return address into R6
diff --git a/Zend/asm/make_riscv64_sysv_elf_gas.S b/Zend/asm/make_riscv64_sysv_elf_gas.S
index 5322e0fdbde..6d97c59e877 100644
--- a/Zend/asm/make_riscv64_sysv_elf_gas.S
+++ b/Zend/asm/make_riscv64_sysv_elf_gas.S
@@ -61,6 +61,7 @@
 .text
 .align  1
 .global make_fcontext
+.hidden make_fcontext
 .type   make_fcontext, %function
 make_fcontext:
     # shift address in a0 (allocated stack) to lower 16 byte boundary
diff --git a/Zend/asm/make_s390x_sysv_elf_gas.S b/Zend/asm/make_s390x_sysv_elf_gas.S
index 4dd423e2a44..4d6aa62c0ae 100644
--- a/Zend/asm/make_s390x_sysv_elf_gas.S
+++ b/Zend/asm/make_s390x_sysv_elf_gas.S
@@ -46,6 +46,7 @@
 .text
 .align	8
 .global	make_fcontext
+.hidden make_fcontext
 .type	make_fcontext, @function

 #define ARG_OFFSET         0
diff --git a/Zend/asm/make_sparc64_sysv_elf_gas.S b/Zend/asm/make_sparc64_sysv_elf_gas.S
index 3e7ee809c91..3d504471afd 100644
--- a/Zend/asm/make_sparc64_sysv_elf_gas.S
+++ b/Zend/asm/make_sparc64_sysv_elf_gas.S
@@ -45,7 +45,7 @@ make_fcontext:
 	add	%l0, (trampoline - 1b - 8), %l0
 	stx	%l0, [%i0 + I7]

-	# Save framepointer to first stack frame but first substract the BIAS
+	# Save framepointer to first stack frame but first subtract the BIAS
 	add	%i0, CC64FSZ - BIAS, %l0
 	stx	%l0, [%i0 + SP]

diff --git a/Zend/asm/make_x86_64_ms_pe_gas.S b/Zend/asm/make_x86_64_ms_pe_gas.S
index 958a2a7b6d0..7146637c031 100644
--- a/Zend/asm/make_x86_64_ms_pe_gas.S
+++ b/Zend/asm/make_x86_64_ms_pe_gas.S
@@ -113,7 +113,7 @@ make_fcontext:
     /* save top address of context stack as 'base' */
     movq  %rcx, 0xc8(%rax)
     /* second arg of make_fcontext() == size of context-stack */
-    /* negate stack size for LEA instruction (== substraction) */
+    /* negate stack size for LEA instruction (== subtraction) */
     negq  %rdx
     /* compute bottom address of context stack (limit) */
     leaq  (%rcx,%rdx), %rcx
@@ -151,7 +151,7 @@ make_fcontext:

 trampoline:
     /* store return address on stack */
-    /* fix stack alignment */
+    /* fix stack alignment */
     pushq %rbp
     /* jump to context-function */
     jmp *%rbx
diff --git a/Zend/asm/make_x86_64_ms_pe_masm.asm b/Zend/asm/make_x86_64_ms_pe_masm.asm
index 8f6c959a837..a6c2b147e44 100644
--- a/Zend/asm/make_x86_64_ms_pe_masm.asm
+++ b/Zend/asm/make_x86_64_ms_pe_masm.asm
@@ -110,7 +110,7 @@ make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
     ; save top address of context stack as 'base'
     mov  [rax+0c8h], rcx
     ; second arg of make_fcontext() == size of context-stack
-    ; negate stack size for LEA instruction (== substraction)
+    ; negate stack size for LEA instruction (== subtraction)
     neg  rdx
     ; compute bottom address of context stack (limit)
     lea  rcx, [rcx+rdx]
@@ -141,7 +141,7 @@ make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
     ; compute abs address of label finish
     lea  rcx, finish
     ; save address of finish as return-address for context-function in RBP
-    ; will be entered after context-function returns
+    ; will be entered after context-function returns
     mov  [rax+0108h], rcx

     ret ; return pointer to context-data
diff --git a/Zend/asm/make_x86_64_sysv_elf_gas.S b/Zend/asm/make_x86_64_sysv_elf_gas.S
index b0d0c0341ef..cabebff6e62 100644
--- a/Zend/asm/make_x86_64_sysv_elf_gas.S
+++ b/Zend/asm/make_x86_64_sysv_elf_gas.S
@@ -44,6 +44,7 @@
 .file "make_x86_64_sysv_elf_gas.S"
 .text
 .globl make_fcontext
+.hidden make_fcontext
 .type make_fcontext,@function
 .align 16
 make_fcontext:
@@ -76,7 +77,7 @@ make_fcontext:
 #if defined(BOOST_CONTEXT_TLS_STACK_PROTECTOR)
     /* save stack guard */
     movq  %fs:0x28, %rcx    /* read stack guard from TLS record */
-    movq  %rcx, 0x8(%rsp)   /* save stack guard */
+    movq  %rcx, 0x8(%rax)   /* save stack guard */
 #endif

     /* compute abs address of label trampoline */
@@ -91,35 +92,6 @@ make_fcontext:
     /* will be entered after context-function returns */
     movq  %rcx, 0x38(%rax)

-#if BOOST_CONTEXT_SHADOW_STACK
-    /* Populate the shadow stack and normal stack */
-    /* get original SSP */
-    rdsspq  %r8
-    /* restore new shadow stack */
-    rstorssp  -0x8(%r9)
-    /* save the restore token on the original shadow stack */
-    saveprevssp
-    /* push the address of "jmp trampoline" to the new shadow stack */
-    /* as well as the stack */
-    call  1f
-    jmp  trampoline
-1:
-    /* save address of "jmp trampoline" as return-address */
-    /* for context-function */
-    pop 0x38(%rax)
-    /* Get the new SSP.  */
-    rdsspq  %r9
-    /* restore original shadow stack */
-    rstorssp  -0x8(%r8)
-    /* save the restore token on the new shadow stack.  */
-    saveprevssp
-
-    /* reserve space for the new SSP */
-    leaq  -0x8(%rax), %rax
-    /* save the new SSP to this fcontext */
-    movq  %r9, (%rax)
-#endif
-
 #if BOOST_CONTEXT_SHADOW_STACK
     /* Populate the shadow stack */

@@ -161,6 +133,8 @@ make_fcontext:
     ret /* return pointer to context-data */

 trampoline:
+    .cfi_startproc
+    .cfi_undefined rip
     /* store return address on stack */
     /* fix stack alignment */
     _CET_ENDBR
@@ -175,6 +149,7 @@ trampoline:
 #endif
     /* jump to context-function */
     jmp *%rbx
+    .cfi_endproc

 finish:
     _CET_ENDBR
diff --git a/Zend/asm/make_x86_64_sysv_macho_gas.S b/Zend/asm/make_x86_64_sysv_macho_gas.S
index 5d6c5431c59..06357f678ac 100644
--- a/Zend/asm/make_x86_64_sysv_macho_gas.S
+++ b/Zend/asm/make_x86_64_sysv_macho_gas.S
@@ -25,6 +25,7 @@
  ****************************************************************************************/

 .text
+.private_extern _make_fcontext
 .globl _make_fcontext
 .align 8
 _make_fcontext: