diff --git a/bjam-alignment.patch b/bjam-alignment.patch new file mode 100644 index 0000000..f6a8688 --- /dev/null +++ b/bjam-alignment.patch @@ -0,0 +1,13 @@ +Index: boost_1_54_0/tools/build/v2/engine/function.c +=================================================================== +--- boost_1_54_0.orig/tools/build/v2/engine/function.c ++++ boost_1_54_0/tools/build/v2/engine/function.c +@@ -230,7 +230,7 @@ STACK * stack_global() + + static void check_alignment( STACK * s ) + { +- assert( (size_t)s->data % sizeof( LIST * ) == 0 ); ++ assert( (size_t)s->data % __alignof__( LIST * ) == 0 ); + } + + void * stack_allocate( STACK * s, int size ) diff --git a/boost-ppc64-abiv2-context.patch b/boost-ppc64-abiv2-context.patch new file mode 100644 index 0000000..16919c3 --- /dev/null +++ b/boost-ppc64-abiv2-context.patch @@ -0,0 +1,752 @@ +diff --git a/boost/context/detail/config.hpp b/boost/context/detail/config.hpp +--- a/boost/context/detail/config.hpp ++++ b/boost/context/detail/config.hpp +@@ -35,4 +35,15 @@ + # include + #endif + ++#undef BOOST_CONTEXT_CALLDECL ++#if (defined(i386) || defined(__i386__) || defined(__i386) \ ++ || defined(__i486__) || defined(__i586__) || defined(__i686__) \ ++ || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \ ++ || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \ ++ || defined(_M_IX86) || defined(_I86_)) && defined(BOOST_WINDOWS) ++# define BOOST_CONTEXT_CALLDECL __cdecl ++#else ++# define BOOST_CONTEXT_CALLDECL ++#endif ++ + #endif // BOOST_CONTEXT_DETAIL_CONFIG_H +diff --git a/boost/context/fcontext.hpp b/boost/context/fcontext.hpp +--- a/boost/context/fcontext.hpp ++++ b/boost/context/fcontext.hpp +@@ -24,51 +24,11 @@ typedef int intptr_t; + # include BOOST_ABI_PREFIX + #endif + +-// x86_64 +-// test x86_64 before i386 because icc might +-// define __i686__ for x86_64 too +-#if defined(__x86_64__) || defined(__x86_64) \ +- || defined(__amd64__) || defined(__amd64) \ +- || defined(_M_X64) || defined(_M_AMD64) +-# if defined(BOOST_WINDOWS) +-# include +-# else +-# include +-# endif +-// i386 +-#elif defined(i386) || defined(__i386__) || defined(__i386) \ +- || defined(__i486__) || defined(__i586__) || defined(__i686__) \ +- || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \ +- || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \ +- || defined(_M_IX86) || defined(_I86_) +-# if defined(BOOST_WINDOWS) +-# include +-# else +-# include +-# endif +-// arm +-#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \ +- || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) +-# include +-// mips +-#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \ +- || defined(_R3000) +-# include +-// powerpc +-#elif defined(__powerpc) || defined(__powerpc__) || defined(__ppc) \ +- || defined(__ppc__) || defined(_ARCH_PPC) || defined(__POWERPC__) \ +- || defined(__PPCGECKO__) || defined(__PPCBROADWAY) || defined(_XENON) +-# include +-#elif defined(__sparc__) || defined(__sparc) +-// sparc or sparc64 +-# include +-#else +-# error "platform not supported" +-#endif +- + namespace boost { + namespace context { + ++typedef void fcontext_t; ++ + extern "C" BOOST_CONTEXT_DECL + intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true); + extern "C" BOOST_CONTEXT_DECL +diff --git a/libs/context/build/Jamfile.v2 b/libs/context/build/Jamfile.v2 +--- a/libs/context/build/Jamfile.v2 ++++ b/libs/context/build/Jamfile.v2 +@@ -210,6 +210,16 @@ alias asm_context_sources + ; + + alias asm_context_sources ++ : asm/make_ppc64_linux_elf_gas.S ++ asm/jump_ppc64_linux_elf_gas.S ++ : 64 ++ power ++ elf ++ linux ++ gcc ++ ; ++ ++alias asm_context_sources + : [ make asm/make_ppc64_sysv_elf_gas.o : asm/make_ppc64_sysv_elf_gas.S : @gas ] + [ make asm/jump_ppc64_sysv_elf_gas.o : asm/jump_ppc64_sysv_elf_gas.S : @gas ] + : 64 +diff --git a/libs/context/src/asm/jump_ppc64_linux_elf_gas.S b/libs/context/src/asm/jump_ppc64_linux_elf_gas.S +--- /dev/null ++++ b/libs/context/src/asm/jump_ppc64_linux_elf_gas.S +@@ -0,0 +1,267 @@ ++/* ++ Copyright Oliver Kowalke 2009. ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENSE_1_0.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) ++*/ ++ ++/******************************************************* ++ * * ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | * ++ * ------------------------------------------------- * ++ * | F14 | F15 | F16 | F17 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | * ++ * ------------------------------------------------- * ++ * | F18 | F19 | F20 | F21 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | * ++ * ------------------------------------------------- * ++ * | F22 | F23 | F24 | F25 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * ++ * ------------------------------------------------- * ++ * | F26 | F27 | F28 | F29 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * ++ * ------------------------------------------------- * ++ * | F30 | F31 | fpscr | TOC | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * ++ * ------------------------------------------------- * ++ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | * ++ * ------------------------------------------------- * ++ * | R14 | R15 | R16 | R17 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | * ++ * ------------------------------------------------- * ++ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | * ++ * ------------------------------------------------- * ++ * | R18 | R19 | R20 | R21 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | * ++ * ------------------------------------------------- * ++ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | * ++ * ------------------------------------------------- * ++ * | R22 | R23 | R24 | R25 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | * ++ * ------------------------------------------------- * ++ * | 256 | 260 | 264 | 268 | 272 | 276 | 280 | 284 | * ++ * ------------------------------------------------- * ++ * | R26 | R27 | R28 | R29 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | * ++ * ------------------------------------------------- * ++ * | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | R30 | R31 | CR | LR | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 80 | 81 | | * ++ * ------------------------------------------------- * ++ * | 320 | 324 | | * ++ * ------------------------------------------------- * ++ * | PC | | * ++ * ------------------------------------------------- * ++ * * ++ *******************************************************/ ++ ++.globl jump_fcontext ++#if _CALL_ELF == 2 ++ .text ++ .align 2 ++jump_fcontext: ++ addis %r2, %r12, .TOC.-jump_fcontext@ha ++ addi %r2, %r2, .TOC.-jump_fcontext@l ++ .localentry jump_fcontext, . - jump_fcontext ++#else ++ .section ".opd","aw" ++ .align 3 ++jump_fcontext: ++# ifdef _CALL_LINUX ++ .quad .L.jump_fcontext,.TOC.@tocbase,0 ++ .type jump_fcontext,@function ++ .text ++ .align 2 ++.L.jump_fcontext: ++# else ++ .hidden .jump_fcontext ++ .globl .jump_fcontext ++ .quad .jump_fcontext,.TOC.@tocbase,0 ++ .size jump_fcontext,24 ++ .type .jump_fcontext,@function ++ .text ++ .align 2 ++.jump_fcontext: ++# endif ++#endif ++ # reserve space on stack ++ subi %r1, %r1, 328 ++ ++#if _CALL_ELF != 2 ++ std %r2, 152(%r1) # save TOC ++#endif ++ std %r14, 160(%r1) # save R14 ++ std %r15, 168(%r1) # save R15 ++ std %r16, 176(%r1) # save R16 ++ std %r17, 184(%r1) # save R17 ++ std %r18, 192(%r1) # save R18 ++ std %r19, 200(%r1) # save R19 ++ std %r20, 208(%r1) # save R20 ++ std %r21, 216(%r1) # save R21 ++ std %r22, 224(%r1) # save R22 ++ std %r23, 232(%r1) # save R23 ++ std %r24, 240(%r1) # save R24 ++ std %r25, 248(%r1) # save R25 ++ std %r26, 256(%r1) # save R26 ++ std %r27, 264(%r1) # save R27 ++ std %r28, 272(%r1) # save R28 ++ std %r29, 280(%r1) # save R29 ++ std %r30, 288(%r1) # save R30 ++ std %r31, 296(%r1) # save R31 ++ ++ # save CR ++ mfcr %r0 ++ std %r0, 304(%r1) ++ # save LR ++ mflr %r0 ++ std %r0, 312(%r1) ++ # save LR as PC ++ std %r0, 320(%r1) ++ ++ # test if fpu env should be preserved ++ cmpwi cr7, %r6, 0 ++ beq cr7, 1f ++ ++ stfd %f14, 0(%r1) # save F14 ++ stfd %f15, 8(%r1) # save F15 ++ stfd %f16, 16(%r1) # save F16 ++ stfd %f17, 24(%r1) # save F17 ++ stfd %f18, 32(%r1) # save F18 ++ stfd %f19, 40(%r1) # save F19 ++ stfd %f20, 48(%r1) # save F20 ++ stfd %f21, 56(%r1) # save F21 ++ stfd %f22, 64(%r1) # save F22 ++ stfd %f23, 72(%r1) # save F23 ++ stfd %f24, 80(%r1) # save F24 ++ stfd %f25, 88(%r1) # save F25 ++ stfd %f26, 96(%r1) # save F26 ++ stfd %f27, 104(%r1) # save F27 ++ stfd %f28, 112(%r1) # save F28 ++ stfd %f29, 120(%r1) # save F29 ++ stfd %f30, 128(%r1) # save F30 ++ stfd %f31, 136(%r1) # save F31 ++ mffs %f0 # load FPSCR ++ stfd %f0, 144(%r1) # save FPSCR ++ ++1: ++ # store RSP (pointing to context-data) in R3 ++ std %r1, 0(%r3) ++ ++ # restore RSP (pointing to context-data) from R4 ++ mr %r1, %r4 ++ ++ # test if fpu env should be preserved ++ cmpwi cr7, %r6, 0 ++ beq cr7, 2f ++ ++ lfd %f14, 0(%r1) # restore F14 ++ lfd %f15, 8(%r1) # restore F15 ++ lfd %f16, 16(%r1) # restore F16 ++ lfd %f17, 24(%r1) # restore F17 ++ lfd %f18, 32(%r1) # restore F18 ++ lfd %f19, 40(%r1) # restore F19 ++ lfd %f20, 48(%r1) # restore F20 ++ lfd %f21, 56(%r1) # restore F21 ++ lfd %f22, 64(%r1) # restore F22 ++ lfd %f23, 72(%r1) # restore F23 ++ lfd %f24, 80(%r1) # restore F24 ++ lfd %f25, 88(%r1) # restore F25 ++ lfd %f26, 96(%r1) # restore F26 ++ lfd %f27, 104(%r1) # restore F27 ++ lfd %f28, 112(%r1) # restore F28 ++ lfd %f29, 120(%r1) # restore F29 ++ lfd %f30, 128(%r1) # restore F30 ++ lfd %f31, 136(%r1) # restore F31 ++ lfd %f0, 144(%r1) # load FPSCR ++ mtfsf 0xff, %f0 # restore FPSCR ++ ++2: ++#if _CALL_ELF != 2 ++ ld %r2, 152(%r1) # restore TOC ++#endif ++ ld %r14, 160(%r1) # restore R14 ++ ld %r15, 168(%r1) # restore R15 ++ ld %r16, 176(%r1) # restore R16 ++ ld %r17, 184(%r1) # restore R17 ++ ld %r18, 192(%r1) # restore R18 ++ ld %r19, 200(%r1) # restore R19 ++ ld %r20, 208(%r1) # restore R20 ++ ld %r21, 216(%r1) # restore R21 ++ ld %r22, 224(%r1) # restore R22 ++ ld %r23, 232(%r1) # restore R23 ++ ld %r24, 240(%r1) # restore R24 ++ ld %r25, 248(%r1) # restore R25 ++ ld %r26, 256(%r1) # restore R26 ++ ld %r27, 264(%r1) # restore R27 ++ ld %r28, 272(%r1) # restore R28 ++ ld %r29, 280(%r1) # restore R29 ++ ld %r30, 288(%r1) # restore R30 ++ ld %r31, 296(%r1) # restore R31 ++ ++ # restore CR ++ ld %r0, 304(%r1) ++ mtcr %r0 ++ # restore LR ++ ld %r0, 312(%r1) ++ mtlr %r0 ++ ++ # load PC ++ ld %r12, 320(%r1) ++ # restore CTR ++ mtctr %r12 ++ ++ # adjust stack ++ addi %r1, %r1, 328 ++ ++ # use third arg as return value after jump ++ # use third arg as first arg in context function ++ mr %r3, %r5 ++ ++ # jump to context ++ bctr ++#if _CALL_ELF == 2 ++ .size jump_fcontext, .-jump_fcontext ++#else ++# ifdef _CALL_LINUX ++ .size .jump_fcontext, .-.L.jump_fcontext ++# else ++ .size .jump_fcontext, .-.jump_fcontext ++# endif ++#endif ++ ++ ++/* Mark that we don't need executable stack. */ ++.section .note.GNU-stack,"",%progbits +diff --git a/libs/context/src/asm/make_ppc64_linux_elf_gas.S b/libs/context/src/asm/make_ppc64_linux_elf_gas.S +--- /dev/null ++++ b/libs/context/src/asm/make_ppc64_linux_elf_gas.S +@@ -0,0 +1,189 @@ ++/* ++ Copyright Oliver Kowalke 2009. ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENSE_1_0.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) ++*/ ++ ++/******************************************************* ++ * * ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | * ++ * ------------------------------------------------- * ++ * | F14 | F15 | F16 | F17 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | * ++ * ------------------------------------------------- * ++ * | F18 | F19 | F20 | F21 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | * ++ * ------------------------------------------------- * ++ * | F22 | F23 | F24 | F25 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * ++ * ------------------------------------------------- * ++ * | F26 | F27 | F28 | F29 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * ++ * ------------------------------------------------- * ++ * | F30 | F31 | fpscr | TOC | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * ++ * ------------------------------------------------- * ++ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | * ++ * ------------------------------------------------- * ++ * | R14 | R15 | R16 | R17 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | * ++ * ------------------------------------------------- * ++ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | * ++ * ------------------------------------------------- * ++ * | R18 | R19 | R20 | R21 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | * ++ * ------------------------------------------------- * ++ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | * ++ * ------------------------------------------------- * ++ * | R22 | R23 | R24 | R25 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | * ++ * ------------------------------------------------- * ++ * | 256 | 260 | 264 | 268 | 272 | 276 | 280 | 284 | * ++ * ------------------------------------------------- * ++ * | R26 | R27 | R28 | R29 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | * ++ * ------------------------------------------------- * ++ * | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | R30 | R31 | CR | LR | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 80 | 81 | | * ++ * ------------------------------------------------- * ++ * | 320 | 324 | | * ++ * ------------------------------------------------- * ++ * | PC | | * ++ * ------------------------------------------------- * ++ * * ++ *******************************************************/ ++ ++.globl make_fcontext ++#if _CALL_ELF == 2 ++ .text ++ .align 2 ++make_fcontext: ++ addis %r2, %r12, .TOC.-make_fcontext@ha ++ addi %r2, %r2, .TOC.-make_fcontext@l ++ .localentry make_fcontext, . - make_fcontext ++#else ++ .section ".opd","aw" ++ .align 3 ++make_fcontext: ++# ifdef _CALL_LINUX ++ .quad .L.make_fcontext,.TOC.@tocbase,0 ++ .type make_fcontext,@function ++ .text ++ .align 2 ++.L.make_fcontext: ++# else ++ .hidden .make_fcontext ++ .globl .make_fcontext ++ .quad .make_fcontext,.TOC.@tocbase,0 ++ .size make_fcontext,24 ++ .type .make_fcontext,@function ++ .text ++ .align 2 ++.make_fcontext: ++# endif ++#endif ++ # save return address into R6 ++ mflr %r6 ++ ++ # first arg of make_fcontext() == top address of context-stack ++ # shift address in R3 to lower 16 byte boundary ++ clrrdi %r3, %r3, 4 ++ ++ # reserve space for context-data on context-stack ++ # including 64 byte of linkage + parameter area (R1 % 16 == 0) ++ subi %r3, %r3, 392 ++ ++ # third arg of make_fcontext() == address of context-function ++ # entry point (ELFv2) or descriptor (ELFv1) ++#if _CALL_ELF == 2 ++ # save address of context-function entry point ++ std %r5, 320(%r3) ++#else ++ # save address of context-function entry point ++ ld %r4, 0(%r5) ++ std %r4, 320(%r3) ++ # save TOC of context-function ++ ld %r4, 8(%r5) ++ std %r4, 152(%r3) ++#endif ++ ++ # load LR ++ mflr %r0 ++ # jump to label 1 ++ bl 1f ++1: ++ # load LR into R4 ++ mflr %r4 ++ # compute abs address of label finish ++ addi %r4, %r4, finish - 1b ++ # restore LR ++ mtlr %r0 ++ # save address of finish as return-address for context-function ++ # will be entered after context-function returns ++ std %r4, 312(%r3) ++ ++ # restore return address from R6 ++ mtlr %r6 ++ ++ blr # return pointer to context-data ++ ++finish: ++ # save return address into R0 ++ mflr %r0 ++ # save return address on stack, set up stack frame ++ std %r0, 8(%r1) ++ # allocate stack space, R1 % 16 == 0 ++ stdu %r1, -32(%r1) ++ ++ # exit code is zero ++ li %r3, 0 ++ # exit application ++ bl _exit ++ nop ++#if _CALL_ELF == 2 ++ .size make_fcontext, .-make_fcontext ++#else ++# ifdef _CALL_LINUX ++ .size .make_fcontext, .-.L.make_fcontext ++# else ++ .size .make_fcontext, .-.make_fcontext ++# endif ++#endif ++ ++/* Mark that we don't need executable stack. */ ++.section .note.GNU-stack,"",%progbits +diff --git a/libs/context/test/test_context.cpp b/libs/context/test/test_context.cpp +--- a/libs/context/test/test_context.cpp ++++ b/libs/context/test/test_context.cpp +@@ -27,8 +27,10 @@ typedef ctx::simple_stack_allocator< + 8 * 1024 // 8kB + > stack_allocator; + +-ctx::fcontext_t fcm; +-ctx::fcontext_t * fc = 0; ++ctx::fcontext_t *fcm = 0; ++ctx::fcontext_t *fc = 0; ++ctx::fcontext_t *fc1 = 0; ++ctx::fcontext_t *fc2 = 0; + int value1 = 0; + std::string value2; + double value3 = 0.; +@@ -36,25 +38,25 @@ double value3 = 0.; + void f1( intptr_t) + { + ++value1; +- ctx::jump_fcontext( fc, & fcm, 0); ++ ctx::jump_fcontext( & fc, fcm, 0); + } + + void f3( intptr_t) + { + ++value1; +- ctx::jump_fcontext( fc, & fcm, 0); ++ ctx::jump_fcontext( & fc, fcm, 0); + ++value1; +- ctx::jump_fcontext( fc, & fcm, 0); ++ ctx::jump_fcontext( & fc, fcm, 0); + } + + void f4( intptr_t) + { +- ctx::jump_fcontext( fc, & fcm, 7); ++ ctx::jump_fcontext( & fc, fcm, 7); + } + + void f5( intptr_t arg) + { +- ctx::jump_fcontext( fc, & fcm, arg); ++ ctx::jump_fcontext( & fc, fcm, arg); + } + + void f6( intptr_t arg) +@@ -62,9 +64,9 @@ void f6( intptr_t arg) + std::pair< int, int > data = * ( std::pair< int, int > * ) arg; + int res = data.first + data.second; + data = * ( std::pair< int, int > *) +- ctx::jump_fcontext( fc, & fcm, ( intptr_t) res); ++ ctx::jump_fcontext( & fc, fcm, ( intptr_t) res); + res = data.first + data.second; +- ctx::jump_fcontext( fc, & fcm, ( intptr_t) res); ++ ctx::jump_fcontext( & fc, fcm, ( intptr_t) res); + } + + void f7( intptr_t arg) +@@ -73,7 +75,7 @@ void f7( intptr_t arg) + { throw std::runtime_error( ( char *) arg); } + catch ( std::runtime_error const& e) + { value2 = e.what(); } +- ctx::jump_fcontext( fc, & fcm, arg); ++ ctx::jump_fcontext( & fc, fcm, arg); + } + + void f8( intptr_t arg) +@@ -81,7 +83,24 @@ void f8( intptr_t arg) + double d = * ( double *) arg; + d += 3.45; + value3 = d; +- ctx::jump_fcontext( fc, & fcm, 0); ++ ctx::jump_fcontext( & fc, fcm, 0); ++} ++ ++void f10( intptr_t) ++{ ++ value1 = 3; ++ ctx::jump_fcontext( & fc2, fc1, 0); ++} ++ ++void f9( intptr_t) ++{ ++ std::cout << "f1: entered" << std::endl; ++ ++ stack_allocator alloc; ++ void * sp = alloc.allocate( stack_allocator::default_stacksize()); ++ fc2 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f10); ++ ctx::jump_fcontext( & fc1, fc2, 0); ++ ctx::jump_fcontext( & fc1, fcm, 0); + } + + void test_setup() +@@ -91,8 +110,6 @@ void test_setup() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f1); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + } + + void test_start() +@@ -104,8 +121,6 @@ void test_start() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f1); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + BOOST_CHECK_EQUAL( 0, value1); + ctx::jump_fcontext( & fcm, fc, 0); +@@ -121,8 +136,6 @@ void test_jump() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f3); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + BOOST_CHECK_EQUAL( 0, value1); + ctx::jump_fcontext( & fcm, fc, 0); +@@ -138,8 +151,6 @@ void test_result() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f4); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + int result = ( int) ctx::jump_fcontext( & fcm, fc, 0); + BOOST_CHECK_EQUAL( 7, result); +@@ -153,8 +164,6 @@ void test_arg() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f5); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + int result = ( int) ctx::jump_fcontext( & fcm, fc, i); + BOOST_CHECK_EQUAL( i, result); +@@ -168,8 +177,6 @@ void test_transfer() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f6); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + int result = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & data); + BOOST_CHECK_EQUAL( 10, result); +@@ -184,10 +191,8 @@ void test_exception() + + const char * what = "hello world"; + void * sp = alloc.allocate( stack_allocator::default_stacksize() ); +- fc = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f7); ++ fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f7); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::default_stacksize(), fc->fc_stack.size); + + ctx::jump_fcontext( & fcm, fc, ( intptr_t) what); + BOOST_CHECK_EQUAL( std::string( what), value2); +@@ -201,13 +206,21 @@ void test_fp() + void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); + fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f8); + BOOST_CHECK( fc); +- BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); +- BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); + + ctx::jump_fcontext( & fcm, fc, (intptr_t) & d); + BOOST_CHECK_EQUAL( 10.58, value3); + } + ++void test_stacked() ++{ ++ value1 = 0; ++ stack_allocator alloc; ++ void * sp = alloc.allocate( stack_allocator::default_stacksize()); ++ fc1 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f9); ++ ctx::jump_fcontext( & fcm, fc1, 0); ++ BOOST_CHECK_EQUAL( 3, value1); ++} ++ + boost::unit_test::test_suite * init_unit_test_suite( int, char* []) + { + boost::unit_test::test_suite * test = +@@ -221,6 +234,7 @@ boost::unit_test::test_suite * init_unit_test_suite( int, char* []) + test->add( BOOST_TEST_CASE( & test_transfer) ); + test->add( BOOST_TEST_CASE( & test_exception) ); + test->add( BOOST_TEST_CASE( & test_fp) ); ++ test->add( BOOST_TEST_CASE( & test_stacked) ); + + return test; + } diff --git a/boost-ppc64-abiv2-coroutine.patch b/boost-ppc64-abiv2-coroutine.patch new file mode 100644 index 0000000..f0e8381 --- /dev/null +++ b/boost-ppc64-abiv2-coroutine.patch @@ -0,0 +1,80 @@ +diff --git a/boost/coroutine/detail/coroutine_context.hpp b/boost/coroutine/detail/coroutine_context.hpp +--- a/boost/coroutine/detail/coroutine_context.hpp ++++ b/boost/coroutine/detail/coroutine_context.hpp +@@ -34,27 +34,33 @@ namespace boost { + namespace coroutines { + namespace detail { + +- +-class BOOST_COROUTINES_DECL coroutine_context : private context::fcontext_t, +- private stack_context ++// class hold stack-context and coroutines execution-context ++class BOOST_COROUTINES_DECL coroutine_context + + { + private: +- stack_context * stack_ctx_; +- context::fcontext_t * ctx_; ++ stack_context stack_ctx_; ++ context::fcontext_t *ctx_; + + public: + typedef void( * ctx_fn)( intptr_t); + ++ // default ctor represents the current execution-context + coroutine_context(); + +- explicit coroutine_context( ctx_fn, stack_context *); ++ // ctor creates a new execution-context running coroutine-fn `fn` ++ // `ctx_` will be allocated on top of the stack managed by parameter ++ // `stack_ctx` ++ coroutine_context( ctx_fn fn, stack_context const& stack_ctx); + + coroutine_context( coroutine_context const&); + + coroutine_context& operator=( coroutine_context const&); + + intptr_t jump( coroutine_context &, intptr_t = 0, bool = true); ++ ++ stack_context & stack_ctx() ++ { return stack_ctx_; } + }; + + }}} +diff --git a/libs/coroutine/src/detail/coroutine_context.cpp b/libs/coroutine/src/detail/coroutine_context.cpp +--- a/libs/coroutine/src/detail/coroutine_context.cpp ++++ b/libs/coroutine/src/detail/coroutine_context.cpp +@@ -34,20 +34,20 @@ namespace coroutines { + namespace detail { + + coroutine_context::coroutine_context() : +- fcontext_t(), stack_ctx_( this), ctx_( this) ++ stack_ctx_(), ++ ctx_( 0) + { + #if defined(BOOST_USE_SEGMENTED_STACKS) + __splitstack_getcontext( stack_ctx_->segments_ctx); + #endif + } + +-coroutine_context::coroutine_context( ctx_fn fn, stack_context * stack_ctx) : +- fcontext_t(), stack_ctx_( stack_ctx), +- ctx_( context::make_fcontext( stack_ctx_->sp, stack_ctx_->size, fn) ) ++coroutine_context::coroutine_context( ctx_fn fn, stack_context const& stack_ctx) : ++ stack_ctx_( stack_ctx), ++ ctx_( context::make_fcontext( stack_ctx_.sp, stack_ctx_.size, fn) ) + {} + + coroutine_context::coroutine_context( coroutine_context const& other) : +- fcontext_t(), + stack_ctx_( other.stack_ctx_), + ctx_( other.ctx_) + {} +@@ -79,7 +79,7 @@ coroutine_context::jump( coroutine_context & other, intptr_t param, bool preserv + + return ret; + #else +- return context::jump_fcontext( ctx_, other.ctx_, param, preserve_fpu); ++ return context::jump_fcontext( & ctx_, other.ctx_, param, preserve_fpu); + #endif + } diff --git a/boost.changes b/boost.changes index 8c0e94a..6c398d2 100644 --- a/boost.changes +++ b/boost.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Tue Apr 29 14:34:41 UTC 2014 - dvaleev@suse.com + +- ppc64 ABIv2 support +- enable build_context for ppc64le +- added patches: + * boost-ppc64-abiv2-context.patch + * boost-ppc64-abiv2-coroutine.patch +------------------------------------------------------------------- +Sat Apr 19 17:40:27 UTC 2014 - schwab@suse.de + +- Fix quoting while creating shared build instructions +- Properly configure library list +- bjam-alignment.patch: fix alignment check in bjam + ------------------------------------------------------------------- Tue Apr 1 08:20:21 UTC 2014 - coolo@suse.com diff --git a/boost.spec b/boost.spec index e902efd..a61850b 100644 --- a/boost.spec +++ b/boost.spec @@ -37,7 +37,7 @@ %endif # context hasn't been ported to most architectures yet -%ifarch %ix86 x86_64 %arm mips ppc ppc64 +%ifarch %ix86 x86_64 %arm mips ppc ppc64 ppc64le %define build_context 1 %else %define build_context 0 @@ -109,6 +109,7 @@ Patch9: boost-pool_check_overflow.patch Patch20: boost-strict_aliasing.patch Patch50: boost-use_std_xml_catalog.patch Patch60: boost-glibc-2.18.patch +Patch61: bjam-alignment.patch #PATCH-FIX-UPSTREAM A post-release patch. Patch71: boost-1.54-001-coroutine.patch #PATCH-FIX-UPSTREAM A post-release patch. @@ -119,6 +120,11 @@ Patch73: boost-1.54-003-log.patch Patch74: boost-1.54-change85160.patch #PATCH-FIX-UPSTREAM https://svn.boost.org/trac/boost/ticket/9041 Patch75: boost-1.54.0-thread-link_atomic.patch +#PATCH-FIX-UPSTREAM https://github.com/boost-at/boost_1_55_0/commit/4221b902fe3a3a9ff1e2d384acf46eceda782160 +Patch76: boost-ppc64-abiv2-context.patch +#PATCH-FIX-UPSTREAM https://github.com/boost-at/boost_1_55_0/commit/e0fc16ec166c90564487f99078ed228e27828d2e +Patch77: boost-ppc64-abiv2-coroutine.patch + Recommends: %{all_libs} %define _docdir %{_datadir}/doc/packages/boost-%{version} @@ -430,11 +436,14 @@ find -type f ! \( -name \*.sh -o -name \*.py -o -name \*.pl \) -exec chmod -x {} %patch20 %patch50 %patch60 -p1 +%patch61 -p1 %patch71 -p1 %patch72 -p1 %patch73 -p1 %patch74 -p0 %patch75 -p1 +%patch76 -p1 +%patch77 -p1 #stupid build machinery copies .orig files find . -name \*.orig -exec rm {} + @@ -442,7 +451,7 @@ find . -name \*.orig -exec rm {} + find . -type f -exec chmod u+w {} + # Create shared build instructions -cat << EOF >.build +cat << \EOF >.build # Now build it J_P=%{jobs} J_G=$(getconf _NPROCESSORS_ONLN) @@ -476,10 +485,10 @@ PYTHON_FLAGS="--with-python-root=/usr --with-python-version=$PYTHON_VERSION" export REGEX_FLAGS="--with-icu" export EXPAT_INCLUDE=/usr/include EXPAT_LIBPATH=%{_libdir} export PYTHON_FLAGS -LIBRARIES_FLAGS= +LIBRARIES_FLAGS=--with-libraries=all %if !%build_context # coroutine depends on context -LIBRARIES_FLAGS+=" --without-context --without-coroutine" +LIBRARIES_FLAGS+=" --without-libraries=context,coroutine" %endif EOF @@ -487,11 +496,11 @@ EOF . ./.build # Set PATH, MANPATH and LD_LIBRARY_PATH for mpi -source /var/mpi-selector/data/$(rpm --qf "%{NAME}-%{VERSION}" -q openmpi).sh +. /var/mpi-selector/data/$(rpm --qf "%{NAME}-%{VERSION}" -q openmpi).sh # use supplied bootstrap.sh instead of mucking with old bjam # see also: https://svn.boost.org/trac/boost/ticket/9304 -./bootstrap.sh --with-libraries=all \ +./bootstrap.sh $LIBRARIES_FLAGS \ --prefix=%{_prefix} --exec-prefix=%{_bindir} \ --libdir=%{_libdir} --includedir=%{_includedir} @@ -526,7 +535,7 @@ cd doc . ./.build # Set PATH, MANPATH and LD_LIBRARY_PATH for mpi -source /var/mpi-selector/data/$(rpm --qf "%{NAME}-%{VERSION}" -q openmpi).sh +. /var/mpi-selector/data/$(rpm --qf "%{NAME}-%{VERSION}" -q openmpi).sh ./b2 install \ --prefix=%{buildroot}%{_prefix} --exec-prefix=%{buildroot}%{_bindir} \