File boost-ppc64-abiv2-context.patch of Package boost
Port to ABIv2
This fuction is now no longer compatible with ABIv1
and so will not function on PPC64 or PPC32. Do not
apply on these architectures.
Index: boost_1_54_0/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
===================================================================
--- boost_1_54_0.orig/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
+++ boost_1_54_0/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
@@ -80,19 +80,17 @@
* *
* *****************************************************************/
-.section ".text"
-.align 2
.globl jump_fcontext
-.section ".opd","aw"
-.align 3
+
+.text
+.align 2
jump_fcontext:
-.quad .jump_fcontext,.TOC.@tocbase,0
-.previous
-.size jump_fcontext,24
-.type .jump_fcontext,@function
-.globl .jump_fcontext
-.jump_fcontext:
- std %r13, 0(%r3) # save R13
+ addis %r2, %r12, .TOC.-jump_fcontext@ha
+ addi %r2, %r2, .TOC.-jump_fcontext@l
+.localentry jump_fcontext, . - jump_fcontext
+
+ # reserved for TLS on ppc64le - don't touch or BOOM!
+ #std %r13, 0(%r3) # save R13
std %r14, 8(%r3) # save R14
std %r15, 16(%r3) # save R15
std %r16, 24(%r3) # save R16
@@ -165,7 +163,7 @@ jump_fcontext:
mtfsf 0xff, %f0 # restore FPSCR
1:
- ld %r13, 0(%r4) # restore R13
+ #ld %r13, 0(%r4) # restore R13
ld %r14, 8(%r4) # restore R14
ld %r15, 16(%r4) # restore R15
ld %r16, 24(%r4) # restore R16
@@ -198,4 +196,8 @@ jump_fcontext:
mtctr %r0 # restore CTR
bctr # jump to context
-.size .jump_fcontext, .-.jump_fcontext
+.size jump_fcontext, .-jump_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
+
Index: boost_1_54_0/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
===================================================================
--- boost_1_54_0.orig/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
+++ boost_1_54_0/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
@@ -80,27 +80,24 @@
* *
* *****************************************************************/
-.section ".text"
+.text
.align 2
.globl make_fcontext
-.section ".opd","aw"
-.align 3
make_fcontext:
-.quad .make_fcontext,.TOC.@tocbase,0
-.previous
-.size make_fcontext,24
-.type .make_fcontext,@function
-.globl .make_fcontext
-.make_fcontext:
+ addis %r2, %r12, .TOC.-make_fcontext@ha
+ addi %r2, %r2, .TOC.-make_fcontext@l
+.localentry make_fcontext, . - make_fcontext
+
mflr %r6 # save return address into R6
mr %r0, %r3
- subi %r3, %r3, 352 # reserve space for fcontext_t at top of context stack
# call align_stack, R3 contains address at 16 byte boundary after return
# == pointer to fcontext_t and address of context stack
clrrdi %r3, %r3, 4
+ subi %r3, %r3, 352 # reserve space for fcontext_t at top of context stack
+
std %r0, 184(%r3) # save address of context stack (base) in fcontext_t
std %r4, 192(%r3) # save context stack size in fcontext_t
std %r5, 176(%r3) # save address of context function in fcontext_t
@@ -130,4 +127,8 @@ finish:
li %r3, 0 # set return value to zero
bl _exit # exit application
nop
-.size .make_fcontext, .-.make_fcontext
+
+.size make_fcontext, .-make_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits