From 4aabfd54c7e753c9611eb269ba31e8d82bef1ab2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 28 2020 06:26:15 +0000 Subject: import boost-1.66.0-9.el8 --- diff --git a/SOURCES/boost-1.66-build-malloc-sizeof.patch b/SOURCES/boost-1.66-build-malloc-sizeof.patch new file mode 100644 index 0000000..b9057ec --- /dev/null +++ b/SOURCES/boost-1.66-build-malloc-sizeof.patch @@ -0,0 +1,25 @@ +From 35ce23a327648a225f5c768a79890a761b9dbe27 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Wed, 10 Oct 2018 13:47:13 +0100 +Subject: [PATCH] Use correct sizeof in malloc call + +This is allocating space for `nel` objects of type `ITEM*` so it should use `sizeof(ITEM*)` not `sizeof(ITEM**)`. + +In practice the values are the same, but using the correct type is better anyway, and now matches the same calculation in the `memset` call in the following statement. +--- + src/engine/hash.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/engine/hash.c b/src/engine/hash.c +index 2fa12030b8..f3dcef88a5 100644 +--- a/tools/build/src/engine/hash.c ++++ b/tools/build/src/engine/hash.c +@@ -248,7 +248,7 @@ static void hashrehash( struct hash * hp ) + BJAM_FREE( (char *)hp->tab.base ); + + hp->tab.nel = hp->items.nel * hp->bloat; +- hp->tab.base = (ITEM * *)BJAM_MALLOC( hp->tab.nel * sizeof( ITEM * * ) ); ++ hp->tab.base = (ITEM * *)BJAM_MALLOC( hp->tab.nel * sizeof( ITEM * ) ); + + memset( (char *)hp->tab.base, '\0', hp->tab.nel * sizeof( ITEM * ) ); + diff --git a/SOURCES/boost-1.66-build-memory-leak.patch b/SOURCES/boost-1.66-build-memory-leak.patch new file mode 100644 index 0000000..efc9be8 --- /dev/null +++ b/SOURCES/boost-1.66-build-memory-leak.patch @@ -0,0 +1,28 @@ +From 8ff11a8eccc41914478e92231500fc47fefa6779 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Wed, 10 Oct 2018 17:17:10 +0100 +Subject: [PATCH] Fix memory leak + +If vsnprintf returns -1 then the buffer should be freed before returning. +--- + src/engine/debugger.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/engine/debugger.c b/src/engine/debugger.c +index 3c811b4557..d849d064a9 100644 +--- a/tools/build/src/engine/debugger.c ++++ b/tools/build/src/engine/debugger.c +@@ -860,10 +860,11 @@ static const char * debug_format_message( const char * format, va_list vargs ) + result = vsnprintf( buf, sz, format, args ); + #endif + va_end( args ); ++ if ( 0 <= result && result < sz ) ++ return buf; ++ free( buf ); + if ( result < 0 ) + return 0; +- if ( result < sz ) return buf; +- free( buf ); + sz = result + 1; + } + } diff --git a/SOURCES/boost-1.66-build-s390x.patch b/SOURCES/boost-1.66-build-s390x.patch new file mode 100644 index 0000000..2b64dbe --- /dev/null +++ b/SOURCES/boost-1.66-build-s390x.patch @@ -0,0 +1,125 @@ + +--- boost_1_66_0/boost/predef/architecture.h 2017-12-14 00:56:47.000000000 +0100 ++++ boost_1_66_0-git/boost/predef/architecture.h 2020-03-23 11:37:30.289735409 +0100 +@@ -21,6 +21,7 @@ http://www.boost.org/LICENSE_1_0.txt) + #include + #include + #include ++#include + #include + #include + #include +--- boost_1_66_0/boost/predef/architecture/s390x.h 1970-01-01 01:00:00.000000000 +0100 ++++ boost_1_66_0-git/boost/predef/architecture/s390x.h 2020-03-23 11:37:48.519735409 +0100 +@@ -0,0 +1,42 @@ ++/* ++Copyright Andreas Krebbel 2020 ++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) ++*/ ++ ++#ifndef BOOST_PREDEF_ARCHITECTURE_S390X_H ++#define BOOST_PREDEF_ARCHITECTURE_S390X_H ++ ++#include ++#include ++ ++/*` ++[heading `BOOST_ARCH_S390X`] ++ ++[@http://en.wikipedia.org/wiki/System/390 System/390] architecture. ++ ++[table ++ [[__predef_symbol__] [__predef_version__]] ++ ++ [[`__s390x__`] [__predef_detection__]] ++ ] ++ */ ++ ++#define BOOST_ARCH_S390X BOOST_VERSION_NUMBER_NOT_AVAILABLE ++ ++#if defined(__s390x__) ++# undef BOOST_ARCH_S390X ++# define BOOST_ARCH_S390X BOOST_VERSION_NUMBER_AVAILABLE ++#endif ++ ++#if BOOST_ARCH_S390X ++# define BOOST_ARCH_S390X_AVAILABLE ++#endif ++ ++#define BOOST_ARCH_S390X_NAME "IBM Z" ++ ++#endif ++ ++#include ++BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_S390X,BOOST_ARCH_S390X_NAME) +--- boost_1_66_0/boostcpp.jam 2017-12-14 00:56:35.000000000 +0100 ++++ boost_1_66_0-git/boostcpp.jam 2020-03-23 11:37:35.829735409 +0100 +@@ -678,7 +678,7 @@ rule address-model ( ) + return @boostcpp.deduce-address-model ; + } + +-local deducable-architectures = arm mips1 power sparc x86 combined ; ++local deducable-architectures = arm mips1 power s390x sparc x86 combined ; + feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ; + for a in $(deducable-architectures) + { +@@ -701,6 +701,10 @@ rule deduce-architecture ( properties * + { + result = power ; + } ++ else if [ configure.builds /boost/architecture//s390x : $(filtered) : s390x ] ++ { ++ result = s390x ; ++ } + else if [ configure.builds /boost/architecture//sparc : $(filtered) : sparc ] + { + result = sparc ; +--- boost_1_66_0/libs/config/checks/architecture/Jamroot.jam 2017-12-14 00:56:42.000000000 +0100 ++++ boost_1_66_0-git/libs/config/checks/architecture/Jamroot.jam 2020-03-23 11:37:35.829735409 +0100 +@@ -19,5 +19,6 @@ obj arm : arm.cpp ; + obj combined : combined.cpp ; + obj mips1 : mips1.cpp ; + obj power : power.cpp ; ++obj s390x : s390x.cpp ; + obj sparc : sparc.cpp ; + obj x86 : x86.cpp ; +--- boost_1_66_0/libs/config/checks/architecture/s390x.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ boost_1_66_0-git/libs/config/checks/architecture/s390x.cpp 2020-03-23 11:37:35.829735409 +0100 +@@ -0,0 +1,11 @@ ++// s390x.cpp ++// ++// Copyright (c) 2020 Andreas Krebbel ++// ++// 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) ++ ++#if !defined(__s390x__) ++#error "Not IBM Z" ++#endif +--- boost_1_66_0/tools/build/src/tools/builtin.py 2017-12-14 00:56:50.000000000 +0100 ++++ boost_1_66_0-git/tools/build/src/tools/builtin.py 2020-03-23 11:37:35.829735409 +0100 +@@ -250,6 +250,9 @@ def register_globals (): + # ia64 + 'ia64', + ++ # IBM Z ++ 's390x', ++ + # Sparc + 'sparc', + +--- boost_1_66_0/tools/build/src/tools/features/architecture-feature.jam 2017-12-14 00:56:50.000000000 +0100 ++++ boost_1_66_0-git/tools/build/src/tools/features/architecture-feature.jam 2020-03-23 11:37:35.829735409 +0100 +@@ -15,6 +15,9 @@ feature.feature architecture + # ia64 + ia64 + ++ # IBM Z ++ s390x ++ + # Sparc + sparc + diff --git a/SOURCES/boost-1.66-docu-update-architectures.patch b/SOURCES/boost-1.66-docu-update-architectures.patch new file mode 100644 index 0000000..ec87a4e --- /dev/null +++ b/SOURCES/boost-1.66-docu-update-architectures.patch @@ -0,0 +1,24 @@ +From db13a7f7a5c2ca8da48ea364bc9998ccf0aa6184 Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Mon, 23 Mar 2020 09:07:32 +0100 +Subject: [PATCH 2/4] docu: update architectures + +--- + doc/architectures.qbk | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/doc/architectures.qbk b/doc/architectures.qbk +index 893c5b3..de6f55a 100644 +--- a/libs/context/doc/architectures.qbk ++++ b/libs/context/doc/architectures.qbk +@@ -18,6 +18,7 @@ architectures: + [[mips1] [O32|ELF] [-] [-] [-]] + [[ppc32] [SYSV|ELF,XCOFF] [-] [SYSV|MACH-O] [-]] + [[ppc64] [SYSV|ELF,XCOFF] [-] [SYSV|MACH-O] [-]] ++ [[s390x] [SYSV|ELF] [-] [-] [-]] + [[sparc] [-] [-] [-] [-]] + [[x86_64] [SYSV,X32|ELF] [MS|PE] [SYSV|MACH-O] [-]] + ] +-- +2.18.1 + diff --git a/SOURCES/boost-1.66-fix-fcontext-routines.patch b/SOURCES/boost-1.66-fix-fcontext-routines.patch new file mode 100644 index 0000000..30e9571 --- /dev/null +++ b/SOURCES/boost-1.66-fix-fcontext-routines.patch @@ -0,0 +1,736 @@ +From f60b86bddcf964f1a97df7a33aa36bc0160dba38 Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Mon, 23 Mar 2020 09:09:17 +0100 +Subject: [PATCH 4/4] IBM Z: Fix fcontext routines + +--- + src/asm/jump_s390x_sysv_elf_gas.S | 257 +++++++++++++++++------------ + src/asm/make_s390x_sysv_elf_gas.S | 176 ++++++++++---------- + src/asm/ontop_s390x_sysv_elf_gas.S | 238 ++++++++++++++------------ + 3 files changed, 374 insertions(+), 297 deletions(-) + +diff --git a/src/asm/jump_s390x_sysv_elf_gas.S b/src/asm/jump_s390x_sysv_elf_gas.S +index b2163cc..c2a578b 100644 +--- a/libs/context/src/asm/jump_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/jump_s390x_sysv_elf_gas.S +@@ -1,117 +1,156 @@ + /******************************************************* +-* * +-* ------------------------------------------------- * +-* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * +-* ------------------------------------------------- * +-* | 0 | 8 | 16 | 24 | * +-* ------------------------------------------------- * +-* | R6 | R7 | R8 | R9 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * +-* ------------------------------------------------- * +-* | 32 | 40 | 48 | 56 | * +-* ------------------------------------------------- * +-* | R10 | R11 | R12 | R13 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * +-* ------------------------------------------------- * +-* | 64 | 72 | 80 | 88 | * +-* ------------------------------------------------- * +-* | R14/LR | R15 | F1 | F3 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 24 | 25 | 26 | 27 | 28 | 29 | | * +-* ------------------------------------------------- * +-* | 96 | 104 | 112 | 120 | * +-* ------------------------------------------------- * +-* | F5 | F7 | PC | | * +-* ------------------------------------------------- * +-* *****************************************************/ +- +-.file "jump_s390x_sysv_elf_gas.S" ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | t.fctx | t.data | r2 | r6 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | r7 | r8 | r9 | r10 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | r11 | r12 | r13 | r14 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 104 | 112 | 120 | * ++ * ------------------------------------------------- * ++ * | f8 | f9 | f10 | f11 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 136 | 144 | 152 | * ++ * ------------------------------------------------- * ++ * | f12 | f13 | f14 | f15 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * ++ * ------------------------------------------------- * ++ * | 160 | 168 | 176 | | * ++ * ------------------------------------------------- * ++ * | fpc | pc | | | * ++ * ------------------------------------------------- * ++ *******************************************************/ ++ + .text +-.align 4 # According to the sample code in the ELF ABI docs +-.global jump_fcontext +-.type jump_fcontext, @function +- +-#define GR_OFFSET 0 +-#define LR_OFFSET 64 +-#define SP_OFFSET 72 +-#define FP_OFFSET 80 +-#define PC_OFFSET 112 +-#define L_CTX 120 +-#define L_STACKFRAME 120 ++.align 8 ++.global jump_fcontext ++.type jump_fcontext, @function ++ ++#define ARG_OFFSET 0 ++#define GR_OFFSET 16 ++#define FP_OFFSET 96 ++#define FPC_OFFSET 160 ++#define PC_OFFSET 168 ++#define CONTEXT_SIZE 176 ++ ++#define REG_SAVE_AREA_SIZE 160 ++ ++/* ++ ++typedef void* fcontext_t; ++ ++struct transfer_t { ++ fcontext_t fctx; ++ void * data; ++}; ++ ++transfer_t jump_fcontext( fcontext_t const to, ++ void * data); ++ ++Incoming args ++r2 - Hidden argument to the location where the return transfer_t needs to be returned ++r3 - Context we want to switch to ++r4 - Data pointer ++ ++*/ + + jump_fcontext: +- +- # Reserved the space for stack to store the data of current context +- # before we jump to the new context. +- aghi %r15,-L_STACKFRAME +- +- # save the registers to the stack +- stmg %r6, %r15, GR_OFFSET(%r15) +- +- # save the floating point registers +- std %f0,FP_OFFSET(%r15) +- std %f3,FP_OFFSET+8(%r15) +- std %f5,FP_OFFSET+16(%r15) +- std %f7,FP_OFFSET+24(%r15) +- +- # Save LR as PC +- stg %r14,PC_OFFSET(%r15) +- +- # Store the SP pointing to the old context-data into R0 +- lgr %r0,%r15 +- +- # Get the SP pointing to the new context-data +- # Note: Since the return type of the jump_fcontext is struct whose +- # size is more than 8. The compiler automatically passes the +- # address of the transfer_t where the data needs to store into R2. +- +- # Hence the first param passed to the jump_fcontext which represent +- # the fctx we want to switch to is present in R3 +- # R2 --> Address of the return transfer_t struct +- # R3 --> Context we want to switch to +- # R4 --> Data +- lgr %r15,%r3 +- +- # Load the registers with the data present in context-data of the +- # context we are going to switch to +- lmg %r6, %r14, GR_OFFSET(%r15) +- +- # Restore Floating point registers +- ld %f1,FP_OFFSET(%r15) +- ld %f3,FP_OFFSET+8(%r15) +- ld %f5,FP_OFFSET+16(%r15) +- ld %f7,FP_OFFSET+24(%r15) +- +- # Load PC +- lg %r1,PC_OFFSET(%r15) +- +- # Adjust the stack +- aghi %r15,120 +- +- # R2 --> Address where the return transfer_t is stored +- # R0 --> FCTX +- # R4 --> DATA +- +- # Store the elements to return transfer_t +- stg %r15, 0(%r2) +- stg %r4, 8(%r2) +- +- # Note: The address in R2 points to the place where the return +- # transfer_t is stored. Since context_function take transfer_t +- # as first parameter. And R2 is the register which holds the +- # first parameter value. +- +- #jump to context +- br %r1 ++ .machine "z10" ++ /* Reserve stack space to store the current context. */ ++ aghi %r15,-CONTEXT_SIZE + +-.size jump_fcontext,.-jump_fcontext +-# Mark that we don't need executable stack. +-.section .note.GNU-stack,"",%progbits ++ /* Save the argument register holding the location of the return value. */ ++ stg %r2,GR_OFFSET(%r15) ++ ++ /* Save the call-saved general purpose registers. */ ++ stmg %r6,%r14,GR_OFFSET+8(%r15) ++ ++ /* Save call-saved floating point registers. */ ++ std %f8,FP_OFFSET(%r15) ++ std %f9,FP_OFFSET+8(%r15) ++ std %f10,FP_OFFSET+16(%r15) ++ std %f11,FP_OFFSET+24(%r15) ++ std %f12,FP_OFFSET+32(%r15) ++ std %f13,FP_OFFSET+40(%r15) ++ std %f14,FP_OFFSET+48(%r15) ++ std %f15,FP_OFFSET+56(%r15) ++ ++ /* Save the return address as current pc. */ ++ stg %r14,PC_OFFSET(%r15) + ++ /* Save the floating point control register. */ ++ stfpc FPC_OFFSET(%r15) + ++ /* Backup the stack pointer pointing to the old context-data into r1. */ ++ lgr %r1,%r15 + ++ /* Load the new context pointer as stack pointer. */ ++ lgr %r15,%r3 ++ ++ /* Restore the call-saved GPRs from the new context. */ ++ lmg %r6,%r14,GR_OFFSET+8(%r15) ++ ++ /* Restore call-saved floating point registers. */ ++ ld %f8,FP_OFFSET(%r15) ++ ld %f9,FP_OFFSET+8(%r15) ++ ld %f10,FP_OFFSET+16(%r15) ++ ld %f11,FP_OFFSET+24(%r15) ++ ld %f12,FP_OFFSET+32(%r15) ++ ld %f13,FP_OFFSET+40(%r15) ++ ld %f14,FP_OFFSET+48(%r15) ++ ld %f15,FP_OFFSET+56(%r15) ++ ++ /* Load the floating point control register. */ ++ lfpc FPC_OFFSET(%r15) ++ ++ /* Restore PC - the location where we will jump to at the end. */ ++ lg %r5,PC_OFFSET(%r15) ++ ++ ltg %r2,GR_OFFSET(%r15) ++ jnz use_return_slot ++ ++ /* We restore a make_fcontext context. Use the function ++ argument slot in the context we just saved and allocate the ++ register save area for the target function. */ ++ la %r2,ARG_OFFSET(%r1) ++ aghi %r15,-REG_SAVE_AREA_SIZE ++ ++use_return_slot: ++ /* Save the two fields in transfer_t. When calling a ++ make_fcontext function this becomes the function argument of ++ the target function, otherwise it will be the return value of ++ jump_fcontext. */ ++ stg %r1,0(%r2) ++ stg %r4,8(%r2) ++ ++ /* Free the restored context. */ ++ aghi %r15,CONTEXT_SIZE ++ ++ /* Jump to the PC loaded from the new context. */ ++ br %r5 ++ ++ ++.size jump_fcontext,.-jump_fcontext ++.section .note.GNU-stack,"",%progbits +diff --git a/src/asm/make_s390x_sysv_elf_gas.S b/src/asm/make_s390x_sysv_elf_gas.S +index d02856c..e7e2d5f 100644 +--- a/libs/context/src/asm/make_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/make_s390x_sysv_elf_gas.S +@@ -1,104 +1,108 @@ + /******************************************************* +-* * +-* ------------------------------------------------- * +-* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * +-* ------------------------------------------------- * +-* | 0 | 8 | 16 | 24 | * +-* ------------------------------------------------- * +-* | R6 | R7 | R8 | R9 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * +-* ------------------------------------------------- * +-* | 32 | 40 | 48 | 56 | * +-* ------------------------------------------------- * +-* | R10 | R11 | R12 | R13 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * +-* ------------------------------------------------- * +-* | 64 | 72 | 80 | 88 | * +-* ------------------------------------------------- * +-* | R14/LR | R15 | F1 | F3 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 24 | 25 | 26 | 27 | 28 | 29 | | * +-* ------------------------------------------------- * +-* | 96 | 104 | 112 | 120 | * +-* ------------------------------------------------- * +-* | F5 | F7 | PC | | * +-* ------------------------------------------------- * +-* *****************************************************/ +- +-.file "make_s390x_sysv_elf_gas.S" ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | t.fctx | t.data | r2 | r6 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | r7 | r8 | r9 | r10 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | r11 | r12 | r13 | r14 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 104 | 112 | 120 | * ++ * ------------------------------------------------- * ++ * | f8 | f9 | f10 | f11 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 136 | 144 | 152 | * ++ * ------------------------------------------------- * ++ * | f12 | f13 | f14 | f15 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * ++ * ------------------------------------------------- * ++ * | 160 | 168 | 176 | | * ++ * ------------------------------------------------- * ++ * | fpc | pc | | | * ++ * ------------------------------------------------- * ++ *******************************************************/ ++ + .text +-.align 4 # According to the sample code in the ELF ABI docs +-.global make_fcontext +-.type make_fcontext, @function +- +-#define GR_OFFSET 0 +-#define LR_OFFSET 64 +-#define SP_OFFSET 72 +-#define FP_OFFSET 80 +-#define PC_OFFSET 112 +-#define L_CTX 120 +-#define L_STACKFRAME 120 ++.align 8 ++.global make_fcontext ++.type make_fcontext, @function + +-make_fcontext: ++#define ARG_OFFSET 0 ++#define GR_OFFSET 16 ++#define R14_OFFSET 88 ++#define FP_OFFSET 96 ++#define FPC_OFFSET 160 ++#define PC_OFFSET 168 ++#define CONTEXT_SIZE 176 + +- # make_fcontext takes in 3 arguments +- # arg1 --> The address where the context needs to be made +- # arg2 --> The size of the context +- # arg3 --> The address of the context function ++/* + +- # According to the ELF ABI, the register R2 holds the first arg. +- # R2 also acts as the register which holds return value +- # Register R3 holds the second, R4 the third so on. ++fcontext_t make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) ); + +- # Shift the address in R2 to a lower 8 byte boundary ++Create and return a context below SP to call FN. + +- # This is done because according to the ELF ABI Doc, the stack needs +- # to be 8 byte aligned. +- # In order to do so, we need to make sure that the address is divisible +- # by 8. We can check this, by checking if the the last 3 bits of the +- # address is zero or not. If not AND it with `-8`. ++Incoming args ++r2 - The stack location where to create the context ++r3 - The size of the context ++r4 - The address of the context function + +- # Here we AND the lower 16 bits of the memory address present in the +- # R2 with the bits 1111 1111 1111 1000 +- nill %r2,0xfff0 ++*/ + +- # Reserve space for context-data on context-stack. +- # This is done by shifting the SP/address by 112 bytes. +- aghi %r2,-L_CTX ++make_fcontext: ++ .machine "z10" ++ /* Align the stack to an 8 byte boundary. */ ++ nill %r2,0xfff0 + +- # third arg of make_fcontext() == address of the context-function +- # Store the address as a PC to jump in, whenever we call the +- # make_fcontext. +- stg %r4,PC_OFFSET(%r2) ++ /* Allocate stack space for the context. */ ++ aghi %r2,-CONTEXT_SIZE + +- # Save the address of finish as return-address for context-function +- # This will be entered after context-function return +- # The address of finish will be saved in Link register, this register +- # specifies where we need to jump after the function executes +- # completely. +- larl %r1,finish +- stg %r1,LR_OFFSET(%r2) ++ /* Set the r2 save slot to zero. This indicates jump_fcontext ++ that this is a special context. */ ++ mvghi GR_OFFSET(%r2),0 + +- # Return pointer to context data +- # R14 acts as the link register +- # R2 holds the address of the context stack. When we return from the +- # make_fcontext, R2 is passed back. +- br %r14 ++ /* Save the floating point control register. */ ++ stfpc FPC_OFFSET(%r2) + +- finish: ++ /* Store the address of the target function as new pc. */ ++ stg %r4,PC_OFFSET(%r2) + +- # In finish tasks, you load the exit code and exit the make_fcontext +- # This is called when the context-function is entirely executed ++ /* Store a pointer to the finish routine as r14. If a function ++ called via context routines just returns that value will be ++ loaded and used as return address. Hence the program will ++ just exit. */ ++ larl %r1,finish ++ stg %r1,R14_OFFSET(%r2) + +- lghi %r2,0 +- brasl %r14,_exit@PLT ++ /* Return as usual with the new context returned in r2. */ ++ br %r14 ++ ++finish: ++ /* In finish tasks, you load the exit code and exit the ++ make_fcontext This is called when the context-function is ++ entirely executed. */ ++ lghi %r2,0 ++ brasl %r14,_exit@PLT + + .size make_fcontext,.-make_fcontext +-# Mark that we don't need executable stack. + .section .note.GNU-stack,"",%progbits +- +diff --git a/src/asm/ontop_s390x_sysv_elf_gas.S b/src/asm/ontop_s390x_sysv_elf_gas.S +index 4488654..709b3d6 100644 +--- a/libs/context/src/asm/ontop_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/ontop_s390x_sysv_elf_gas.S +@@ -1,112 +1,146 @@ + /******************************************************* +-* * +-* ------------------------------------------------- * +-* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * +-* ------------------------------------------------- * +-* | 0 | 8 | 16 | 24 | * +-* ------------------------------------------------- * +-* | R6 | R7 | R8 | R9 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * +-* ------------------------------------------------- * +-* | 32 | 40 | 48 | 56 | * +-* ------------------------------------------------- * +-* | R10 | R11 | R12 | R13 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * +-* ------------------------------------------------- * +-* | 64 | 72 | 80 | 88 | * +-* ------------------------------------------------- * +-* | R14/LR | R15 | F1 | F3 | * +-* ------------------------------------------------- * +-* ------------------------------------------------- * +-* | 24 | 25 | 26 | 27 | 28 | 29 | | * +-* ------------------------------------------------- * +-* | 96 | 104 | 112 | 120 | * +-* ------------------------------------------------- * +-* | F5 | F7 | PC | | * +-* ------------------------------------------------- * +-* *****************************************************/ +- +-.file "ontop_s390x_sysv_elf_gas.S" ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | t.fctx | t.data | r2 | r6 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | r7 | r8 | r9 | r10 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | r11 | r12 | r13 | r14 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 104 | 112 | 120 | * ++ * ------------------------------------------------- * ++ * | f8 | f9 | f10 | f11 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 136 | 144 | 152 | * ++ * ------------------------------------------------- * ++ * | f12 | f13 | f14 | f15 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * ++ * ------------------------------------------------- * ++ * | 160 | 168 | 176 | | * ++ * ------------------------------------------------- * ++ * | fpc | pc | | | * ++ * ------------------------------------------------- * ++ *******************************************************/ ++ + .text +-.align 4 # According to the sample code in the ELF ABI docs ++.align 8 + .global ontop_fcontext + .type ontop_fcontext, @function + +-#define GR_OFFSET 0 +-#define LR_OFFSET 64 +-#define SP_OFFSET 72 +-#define FP_OFFSET 80 +-#define PC_OFFSET 112 +-#define L_CTX 120 ++#define ARG_OFFSET 0 ++#define GR_OFFSET 16 ++#define R14_OFFSET 88 ++#define FP_OFFSET 96 ++#define FPC_OFFSET 160 ++#define PC_OFFSET 168 ++#define CONTEXT_SIZE 176 ++ ++ ++/* ++ ++typedef void* fcontext_t; ++ ++struct transfer_t { ++ fcontext_t fctx; ++ void * data; ++}; ++ ++transfer_t ontop_fcontext( fcontext_t const to, ++ void * vp, ++ transfer_t (* fn)( transfer_t) ); ++ ++Incoming args ++r2 - Hidden argument to the location where the return transfer_t needs to be returned ++r3 - Target context ++r4 - Data pointer ++r5 - Function to be executed ++ ++This implementation assumes that ontop_fcontext will never be called with target contexts ++created via make_fcontext. ++ ++*/ + + ontop_fcontext: +- +- # Reserved the space for stack to store the data of current context +- # before we jump to the new context. +- aghi %r15,-L_CTX +- +- # save the registers to the stack +- stmg %r6, %r15, GR_OFFSET(%r15) +- +- # save the floating point registers +- std %f0,FP_OFFSET(%r15) +- std %f3,FP_OFFSET+8(%r15) +- std %f5,FP_OFFSET+16(%r15) +- std %f7,FP_OFFSET+24(%r15) +- # Save LR as PC +- stg %r14,PC_OFFSET(%r15) +- +- # Store the SP pointing to the old context-data into R0 +- lgr %r0,%r15 +- +- # Get the SP pointing to the new context-data +- # Note: Since the return type of the jump_fcontext is struct whose +- # size is more than 8. The compiler automatically passes the +- # address of the transfer_t where the data needs to store into R2. +- +- # Hence the first param passed to the jump_fcontext which represent +- # the fctx we want to switch to is present in R3 +- # R2 --> Address of the return transfer_t struct +- # R3 --> Context we want to switch to +- # R4 --> Data +- lgr %r15,%r3 +- +- # Load the registers with the data present in context-data of the +- # context we are going to switch to +- lmg %r6,%r15,GR_OFFSET(%r15) +- +- # Restore Floating point registers +- ld %f1,FP_OFFSET(%r15) +- ld %f3,FP_OFFSET+8(%r15) +- ld %f5,FP_OFFSET+16(%r15) +- ld %f7,FP_OFFSET+24(%r15) +- +- # Skip PC +- +- # Adjust the stack +- aghi %r15,L_CTX +- +- # R2 --> Address where the return transfer_t is stored +- # R0 --> FCTX +- # R4 --> DATA +- # R5 --> Context function +- +- # Store the elements to return transfer_t +- stg %r15, 0(%r2) +- stg %r4, 8(%r2) +- +- # Note: The address in R2 points to the place where the return +- # transfer_t is stored. Since context_function take transfer_t +- # as first parameter. And R2 is the register which holds the +- # first parameter value. +- +- #jump to context function +- br %r5 ++ /* Reserve stack space to store the current context. */ ++ aghi %r15,-CONTEXT_SIZE ++ ++ /* Save the argument register holding the location of the return value. */ ++ stg %r2,GR_OFFSET(%r15) ++ ++ /* Save the call-saved general purpose registers. */ ++ stmg %r6,%r14,GR_OFFSET+8(%r15) ++ ++ /* Save call-saved floating point registers. */ ++ std %f8,FP_OFFSET(%r15) ++ std %f9,FP_OFFSET+8(%r15) ++ std %f10,FP_OFFSET+16(%r15) ++ std %f11,FP_OFFSET+24(%r15) ++ std %f12,FP_OFFSET+32(%r15) ++ std %f13,FP_OFFSET+40(%r15) ++ std %f14,FP_OFFSET+48(%r15) ++ std %f15,FP_OFFSET+56(%r15) ++ ++ /* Save the return address as current pc. */ ++ stg %r14,PC_OFFSET(%r15) ++ ++ /* Save the floating point control register. */ ++ stfpc FPC_OFFSET(%r15) ++ ++ /* Backup the stack pointer pointing to the old context-data into r1. */ ++ lgr %r1,%r15 ++ ++ /* Load the new context pointer as stack pointer. */ ++ lgr %r15,%r3 ++ ++ /* Restore the call-saved GPRs from the new context. */ ++ lmg %r6,%r14,GR_OFFSET+8(%r15) ++ ++ /* Restore call-saved floating point registers. */ ++ ld %f8,FP_OFFSET(%r15) ++ ld %f9,FP_OFFSET+8(%r15) ++ ld %f10,FP_OFFSET+16(%r15) ++ ld %f11,FP_OFFSET+24(%r15) ++ ld %f12,FP_OFFSET+32(%r15) ++ ld %f13,FP_OFFSET+40(%r15) ++ ld %f14,FP_OFFSET+48(%r15) ++ ld %f15,FP_OFFSET+56(%r15) ++ ++ /* Load the floating point control register. */ ++ lfpc FPC_OFFSET(%r15) ++ ++ /* Store the transfer_t values located in the saved context. */ ++ stg %r1,0(%r1) /* transfer_t.fctx = old context */ ++ stg %r4,8(%r1) /* transfer_t.data = data */ ++ ++ /* Set up the arguments for the target function. */ ++ lg %r2,GR_OFFSET(%r15) ++ lgr %r3,%r1 ++ ++ /* Deallocate the context. */ ++ aghi %r15,CONTEXT_SIZE ++ ++ br %r5 + + .size ontop_fcontext,.-ontop_fcontext +-# Mark that we don't need executable stack. + .section .note.GNU-stack,"",%progbits +-- +2.18.1 + diff --git a/SOURCES/boost-1.66-graph-return-local-addr.patch b/SOURCES/boost-1.66-graph-return-local-addr.patch new file mode 100644 index 0000000..be4b6cd --- /dev/null +++ b/SOURCES/boost-1.66-graph-return-local-addr.patch @@ -0,0 +1,32 @@ +From 5e61a97a0b56d3d4121d3cbb6b85032f9839545a Mon Sep 17 00:00:00 2001 +From: nre +Date: Thu, 22 Dec 2016 13:25:35 +0100 +Subject: [PATCH] Fix compiler error with release builds on VS2015 + +When using MSVC compiler optimization, using param_not_found() causes +compiler error C4172: returning address of local variable or temporary +--- + include/boost/graph/named_function_params.hpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/include/boost/graph/named_function_params.hpp b/include/boost/graph/named_function_params.hpp +index a9a9add6c..4842dc954 100644 +--- a/include/boost/graph/named_function_params.hpp ++++ b/include/boost/graph/named_function_params.hpp +@@ -228,6 +228,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS + }; + + struct param_not_found {}; ++ static param_not_found g_param_not_found; + + template + struct get_param_type: +@@ -237,7 +238,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS + inline + const typename lookup_named_param_def::type& + get_param(const Args& p, Tag) { +- return lookup_named_param_def::get(p, param_not_found()); ++ return lookup_named_param_def::get(p, g_param_not_found); + } + + template diff --git a/SOURCES/boost-1.66-optimize-s390x-instructions.patch b/SOURCES/boost-1.66-optimize-s390x-instructions.patch new file mode 100644 index 0000000..36527fd --- /dev/null +++ b/SOURCES/boost-1.66-optimize-s390x-instructions.patch @@ -0,0 +1,351 @@ +From 519786ec38bb5123547071021e4bd7678d7673ad Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Mon, 23 Mar 2020 09:08:27 +0100 +Subject: [PATCH 3/4] Optimize s390x instructions + +--- + src/asm/jump_s390x_sysv_elf_gas.S | 84 ++++++++++-------------------- + src/asm/make_s390x_sysv_elf_gas.S | 27 ++++++---- + src/asm/ontop_s390x_sysv_elf_gas.S | 81 +++++++++------------------- + 3 files changed, 70 insertions(+), 122 deletions(-) + +diff --git a/src/asm/jump_s390x_sysv_elf_gas.S b/src/asm/jump_s390x_sysv_elf_gas.S +index c011d53..b2163cc 100644 +--- a/libs/context/src/asm/jump_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/jump_s390x_sysv_elf_gas.S +@@ -36,47 +36,34 @@ + .global jump_fcontext + .type jump_fcontext, @function + ++#define GR_OFFSET 0 ++#define LR_OFFSET 64 ++#define SP_OFFSET 72 ++#define FP_OFFSET 80 ++#define PC_OFFSET 112 ++#define L_CTX 120 ++#define L_STACKFRAME 120 ++ + jump_fcontext: + + # Reserved the space for stack to store the data of current context + # before we jump to the new context. +- lay 15,-120(15) ++ aghi %r15,-L_STACKFRAME + + # save the registers to the stack +- stg 6, 0(15) # save R6 +- stg 7, 8(15) # save R7 +- stg 8, 16(15) # save R8 +- stg 9, 24(15) # save R9 +- stg 10, 32(15) # save R10 +- stg 11, 40(15) # save R11 +- stg 12, 48(15) # save R12 +- stg 13, 56(15) # save R13 +- stg 14, 64(15) # save R14 +- stg 15, 72(15) # save R15 ++ stmg %r6, %r15, GR_OFFSET(%r15) + + # save the floating point registers +- # Load the FPR into R0 then save it to the stack +- # Load F1 into R0 +- lgdr 0,1 +- stg 0,80(15) # save F1 +- +- # Load F3 into R0 +- lgdr 0,3 +- stg 0,88(15) # save F3 +- +- # Load F5 into R0 +- lgdr 0,5 +- stg 0,96(15) # save F5 +- +- # Load F7 into R0 +- lgdr 0,7 +- stg 0,104(15) # save F7 ++ std %f0,FP_OFFSET(%r15) ++ std %f3,FP_OFFSET+8(%r15) ++ std %f5,FP_OFFSET+16(%r15) ++ std %f7,FP_OFFSET+24(%r15) + + # Save LR as PC +- stg 14,112(15) ++ stg %r14,PC_OFFSET(%r15) + + # Store the SP pointing to the old context-data into R0 +- lgr 0,15 ++ lgr %r0,%r15 + + # Get the SP pointing to the new context-data + # Note: Since the return type of the jump_fcontext is struct whose +@@ -88,46 +75,31 @@ jump_fcontext: + # R2 --> Address of the return transfer_t struct + # R3 --> Context we want to switch to + # R4 --> Data +- lgr 15,3 ++ lgr %r15,%r3 + + # Load the registers with the data present in context-data of the + # context we are going to switch to +- lg 6, 0(15) # restore R6 +- lg 7, 8(15) # restore R7 +- lg 8, 16(15) # restore R8 +- lg 9, 24(15) # restore R9 +- lg 10, 32(15) # restore R10 +- lg 11, 40(15) # restore R11 +- lg 12, 48(15) # restore R12 +- lg 13, 56(15) # restore R13 +- lg 14, 64(15) # restore R14 ++ lmg %r6, %r14, GR_OFFSET(%r15) + + # Restore Floating point registers +- lg 1,80(15) +- ldgr 1,1 # restore F1 +- +- lg 1,88(15) +- ldgr 1,3 # restore F3 +- +- lg 1,96(15) +- ldgr 1,5 # restore F5 +- +- lg 1,104(15) +- ldgr 1,7 # restore F7 ++ ld %f1,FP_OFFSET(%r15) ++ ld %f3,FP_OFFSET+8(%r15) ++ ld %f5,FP_OFFSET+16(%r15) ++ ld %f7,FP_OFFSET+24(%r15) + + # Load PC +- lg 1,112(15) ++ lg %r1,PC_OFFSET(%r15) + +- # Adjust the stack +- lay 15, 120(15) ++ # Adjust the stack ++ aghi %r15,120 + + # R2 --> Address where the return transfer_t is stored + # R0 --> FCTX + # R4 --> DATA + + # Store the elements to return transfer_t +- stg 15, 0(2) +- stg 4, 8(2) ++ stg %r15, 0(%r2) ++ stg %r4, 8(%r2) + + # Note: The address in R2 points to the place where the return + # transfer_t is stored. Since context_function take transfer_t +@@ -135,7 +107,7 @@ jump_fcontext: + # first parameter value. + + #jump to context +- br 1 ++ br %r1 + + .size jump_fcontext,.-jump_fcontext + # Mark that we don't need executable stack. +diff --git a/src/asm/make_s390x_sysv_elf_gas.S b/src/asm/make_s390x_sysv_elf_gas.S +index f566533..d02856c 100644 +--- a/libs/context/src/asm/make_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/make_s390x_sysv_elf_gas.S +@@ -36,6 +36,14 @@ + .global make_fcontext + .type make_fcontext, @function + ++#define GR_OFFSET 0 ++#define LR_OFFSET 64 ++#define SP_OFFSET 72 ++#define FP_OFFSET 80 ++#define PC_OFFSET 112 ++#define L_CTX 120 ++#define L_STACKFRAME 120 ++ + make_fcontext: + + # make_fcontext takes in 3 arguments +@@ -56,40 +64,39 @@ make_fcontext: + # address is zero or not. If not AND it with `-8`. + + # Here we AND the lower 16 bits of the memory address present in the +- # R2 with the bits 1111 1111 1111 1000 which when converted into +- # decimal is 65528 +- nill 2,65528 ++ # R2 with the bits 1111 1111 1111 1000 ++ nill %r2,0xfff0 + + # Reserve space for context-data on context-stack. + # This is done by shifting the SP/address by 112 bytes. +- lay 2,-120(2) ++ aghi %r2,-L_CTX + + # third arg of make_fcontext() == address of the context-function + # Store the address as a PC to jump in, whenever we call the + # make_fcontext. +- stg 4,112(2) ++ stg %r4,PC_OFFSET(%r2) + + # Save the address of finish as return-address for context-function + # This will be entered after context-function return + # The address of finish will be saved in Link register, this register + # specifies where we need to jump after the function executes + # completely. +- larl 1,finish +- stg 1,64(2) ++ larl %r1,finish ++ stg %r1,LR_OFFSET(%r2) + + # Return pointer to context data + # R14 acts as the link register + # R2 holds the address of the context stack. When we return from the + # make_fcontext, R2 is passed back. +- br 14 ++ br %r14 + + finish: + + # In finish tasks, you load the exit code and exit the make_fcontext + # This is called when the context-function is entirely executed + +- lghi 2,0 +- brasl 14,_exit ++ lghi %r2,0 ++ brasl %r14,_exit@PLT + + .size make_fcontext,.-make_fcontext + # Mark that we don't need executable stack. +diff --git a/src/asm/ontop_s390x_sysv_elf_gas.S b/src/asm/ontop_s390x_sysv_elf_gas.S +index 7ab2cf5..4488654 100644 +--- a/libs/context/src/asm/ontop_s390x_sysv_elf_gas.S ++++ b/libs/context/src/asm/ontop_s390x_sysv_elf_gas.S +@@ -36,47 +36,32 @@ + .global ontop_fcontext + .type ontop_fcontext, @function + ++#define GR_OFFSET 0 ++#define LR_OFFSET 64 ++#define SP_OFFSET 72 ++#define FP_OFFSET 80 ++#define PC_OFFSET 112 ++#define L_CTX 120 ++ + ontop_fcontext: + + # Reserved the space for stack to store the data of current context + # before we jump to the new context. +- lay 15,-120(15) ++ aghi %r15,-L_CTX + + # save the registers to the stack +- stg 6, 0(15) # save R6 +- stg 7, 8(15) # save R7 +- stg 8, 16(15) # save R8 +- stg 9, 24(15) # save R9 +- stg 10, 32(15) # save R10 +- stg 11, 40(15) # save R11 +- stg 12, 48(15) # save R12 +- stg 13, 56(15) # save R13 +- stg 14, 64(15) # save R14 +- stg 15, 72(15) # save R15 ++ stmg %r6, %r15, GR_OFFSET(%r15) + + # save the floating point registers +- # Load the FPR into R0 then save it to the stack +- # Load F1 into R0 +- lgdr 0,1 +- stg 0,80(15) # save F1 +- +- # Load F3 into R0 +- lgdr 0,3 +- stg 0,88(15) # save F3 +- +- # Load F5 into R0 +- lgdr 0,5 +- stg 0,96(15) # save F5 +- +- # Load F7 into R0 +- lgdr 0,7 +- stg 0,104(15) # save F7 +- ++ std %f0,FP_OFFSET(%r15) ++ std %f3,FP_OFFSET+8(%r15) ++ std %f5,FP_OFFSET+16(%r15) ++ std %f7,FP_OFFSET+24(%r15) + # Save LR as PC +- stg 14,112(15) ++ stg %r14,PC_OFFSET(%r15) + + # Store the SP pointing to the old context-data into R0 +- lgr 0,15 ++ lgr %r0,%r15 + + # Get the SP pointing to the new context-data + # Note: Since the return type of the jump_fcontext is struct whose +@@ -88,38 +73,22 @@ ontop_fcontext: + # R2 --> Address of the return transfer_t struct + # R3 --> Context we want to switch to + # R4 --> Data +- lgr 15,3 ++ lgr %r15,%r3 + + # Load the registers with the data present in context-data of the + # context we are going to switch to +- lg 6, 0(15) # restore R6 +- lg 7, 8(15) # restore R7 +- lg 8, 16(15) # restore R8 +- lg 9, 24(15) # restore R9 +- lg 10, 32(15) # restore R10 +- lg 11, 40(15) # restore R11 +- lg 12, 48(15) # restore R12 +- lg 13, 56(15) # restore R13 +- lg 14, 64(15) # restore R14 +- lg 15, 72(15) # restore R15 ++ lmg %r6,%r15,GR_OFFSET(%r15) + + # Restore Floating point registers +- lg 1,80(15) +- ldgr 1,1 # restore F1 +- +- lg 1,88(15) +- ldgr 1,3 # restore F3 +- +- lg 1,96(15) +- ldgr 1,5 # restore F5 +- +- lg 1,104(15) +- ldgr 1,7 # restore F7 ++ ld %f1,FP_OFFSET(%r15) ++ ld %f3,FP_OFFSET+8(%r15) ++ ld %f5,FP_OFFSET+16(%r15) ++ ld %f7,FP_OFFSET+24(%r15) + + # Skip PC + + # Adjust the stack +- lay 15, 120(15) ++ aghi %r15,L_CTX + + # R2 --> Address where the return transfer_t is stored + # R0 --> FCTX +@@ -127,8 +96,8 @@ ontop_fcontext: + # R5 --> Context function + + # Store the elements to return transfer_t +- stg 15, 0(2) +- stg 4, 8(2) ++ stg %r15, 0(%r2) ++ stg %r4, 8(%r2) + + # Note: The address in R2 points to the place where the return + # transfer_t is stored. Since context_function take transfer_t +@@ -136,7 +105,7 @@ ontop_fcontext: + # first parameter value. + + #jump to context function +- br 5 ++ br %r5 + + .size ontop_fcontext,.-ontop_fcontext + # Mark that we don't need executable stack. +-- +2.18.1 + diff --git a/SOURCES/boost-1.66-support-s390x-arch.patch b/SOURCES/boost-1.66-support-s390x-arch.patch new file mode 100644 index 0000000..ada7c3b --- /dev/null +++ b/SOURCES/boost-1.66-support-s390x-arch.patch @@ -0,0 +1,461 @@ +From ffa7c8b7f8033413d7088edcd9947bf782b9d3fd Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Mon, 23 Mar 2020 09:04:54 +0100 +Subject: [PATCH 1/4] S390x: Add Support for s390x arch + +--- + build/Jamfile.v2 | 13 +++ + build/architecture.jam | 4 + + src/asm/jump_s390x_sysv_elf_gas.S | 145 +++++++++++++++++++++++++++++ + src/asm/make_s390x_sysv_elf_gas.S | 97 +++++++++++++++++++ + src/asm/ontop_s390x_sysv_elf_gas.S | 143 ++++++++++++++++++++++++++++ + 5 files changed, 402 insertions(+) + create mode 100644 src/asm/jump_s390x_sysv_elf_gas.S + create mode 100644 src/asm/make_s390x_sysv_elf_gas.S + create mode 100644 src/asm/ontop_s390x_sysv_elf_gas.S + +diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 +index 719ca91..08f1675 100644 +--- a/libs/context/build/Jamfile.v2 ++++ b/libs/context/build/Jamfile.v2 +@@ -447,6 +447,19 @@ alias asm_sources + mach-o + ; + ++# S390X ++# S390X/SYSV/ELF ++alias asm_sources ++ : asm/make_s390x_sysv_elf_gas.S ++ asm/jump_s390x_sysv_elf_gas.S ++ asm/ontop_s390x_sysv_elf_gas.S ++ : sysv ++ 64 ++ s390x ++ elf ++ gcc ++ ; ++ + # X86 + # X86/SYSV/ELF + alias asm_sources +diff --git a/build/architecture.jam b/build/architecture.jam +index 81dcb49..f62806d 100644 +--- a/libs/context/build/architecture.jam ++++ b/libs/context/build/architecture.jam +@@ -63,6 +63,10 @@ rule deduce-architecture ( properties * ) + { + return power ; + } ++ else if [ configure.builds /boost/architecture//s390x : $(properties) : s390x ] ++ { ++ return s390x ; ++ } + else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ] + { + return sparc ; +diff --git a/src/asm/jump_s390x_sysv_elf_gas.S b/src/asm/jump_s390x_sysv_elf_gas.S +new file mode 100644 +index 0000000..c011d53 +--- /dev/null ++++ b/libs/context/src/asm/jump_s390x_sysv_elf_gas.S +@@ -0,0 +1,145 @@ ++/******************************************************* ++* * ++* ------------------------------------------------- * ++* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++* ------------------------------------------------- * ++* | 0 | 8 | 16 | 24 | * ++* ------------------------------------------------- * ++* | R6 | R7 | R8 | R9 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++* ------------------------------------------------- * ++* | 32 | 40 | 48 | 56 | * ++* ------------------------------------------------- * ++* | R10 | R11 | R12 | R13 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++* ------------------------------------------------- * ++* | 64 | 72 | 80 | 88 | * ++* ------------------------------------------------- * ++* | R14/LR | R15 | F1 | F3 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 24 | 25 | 26 | 27 | 28 | 29 | | * ++* ------------------------------------------------- * ++* | 96 | 104 | 112 | 120 | * ++* ------------------------------------------------- * ++* | F5 | F7 | PC | | * ++* ------------------------------------------------- * ++* *****************************************************/ ++ ++.file "jump_s390x_sysv_elf_gas.S" ++.text ++.align 4 # According to the sample code in the ELF ABI docs ++.global jump_fcontext ++.type jump_fcontext, @function ++ ++jump_fcontext: ++ ++ # Reserved the space for stack to store the data of current context ++ # before we jump to the new context. ++ lay 15,-120(15) ++ ++ # save the registers to the stack ++ stg 6, 0(15) # save R6 ++ stg 7, 8(15) # save R7 ++ stg 8, 16(15) # save R8 ++ stg 9, 24(15) # save R9 ++ stg 10, 32(15) # save R10 ++ stg 11, 40(15) # save R11 ++ stg 12, 48(15) # save R12 ++ stg 13, 56(15) # save R13 ++ stg 14, 64(15) # save R14 ++ stg 15, 72(15) # save R15 ++ ++ # save the floating point registers ++ # Load the FPR into R0 then save it to the stack ++ # Load F1 into R0 ++ lgdr 0,1 ++ stg 0,80(15) # save F1 ++ ++ # Load F3 into R0 ++ lgdr 0,3 ++ stg 0,88(15) # save F3 ++ ++ # Load F5 into R0 ++ lgdr 0,5 ++ stg 0,96(15) # save F5 ++ ++ # Load F7 into R0 ++ lgdr 0,7 ++ stg 0,104(15) # save F7 ++ ++ # Save LR as PC ++ stg 14,112(15) ++ ++ # Store the SP pointing to the old context-data into R0 ++ lgr 0,15 ++ ++ # Get the SP pointing to the new context-data ++ # Note: Since the return type of the jump_fcontext is struct whose ++ # size is more than 8. The compiler automatically passes the ++ # address of the transfer_t where the data needs to store into R2. ++ ++ # Hence the first param passed to the jump_fcontext which represent ++ # the fctx we want to switch to is present in R3 ++ # R2 --> Address of the return transfer_t struct ++ # R3 --> Context we want to switch to ++ # R4 --> Data ++ lgr 15,3 ++ ++ # Load the registers with the data present in context-data of the ++ # context we are going to switch to ++ lg 6, 0(15) # restore R6 ++ lg 7, 8(15) # restore R7 ++ lg 8, 16(15) # restore R8 ++ lg 9, 24(15) # restore R9 ++ lg 10, 32(15) # restore R10 ++ lg 11, 40(15) # restore R11 ++ lg 12, 48(15) # restore R12 ++ lg 13, 56(15) # restore R13 ++ lg 14, 64(15) # restore R14 ++ ++ # Restore Floating point registers ++ lg 1,80(15) ++ ldgr 1,1 # restore F1 ++ ++ lg 1,88(15) ++ ldgr 1,3 # restore F3 ++ ++ lg 1,96(15) ++ ldgr 1,5 # restore F5 ++ ++ lg 1,104(15) ++ ldgr 1,7 # restore F7 ++ ++ # Load PC ++ lg 1,112(15) ++ ++ # Adjust the stack ++ lay 15, 120(15) ++ ++ # R2 --> Address where the return transfer_t is stored ++ # R0 --> FCTX ++ # R4 --> DATA ++ ++ # Store the elements to return transfer_t ++ stg 15, 0(2) ++ stg 4, 8(2) ++ ++ # Note: The address in R2 points to the place where the return ++ # transfer_t is stored. Since context_function take transfer_t ++ # as first parameter. And R2 is the register which holds the ++ # first parameter value. ++ ++ #jump to context ++ br 1 ++ ++.size jump_fcontext,.-jump_fcontext ++# Mark that we don't need executable stack. ++.section .note.GNU-stack,"",%progbits ++ ++ ++ +diff --git a/src/asm/make_s390x_sysv_elf_gas.S b/src/asm/make_s390x_sysv_elf_gas.S +new file mode 100644 +index 0000000..f566533 +--- /dev/null ++++ b/libs/context/src/asm/make_s390x_sysv_elf_gas.S +@@ -0,0 +1,97 @@ ++/******************************************************* ++* * ++* ------------------------------------------------- * ++* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++* ------------------------------------------------- * ++* | 0 | 8 | 16 | 24 | * ++* ------------------------------------------------- * ++* | R6 | R7 | R8 | R9 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++* ------------------------------------------------- * ++* | 32 | 40 | 48 | 56 | * ++* ------------------------------------------------- * ++* | R10 | R11 | R12 | R13 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++* ------------------------------------------------- * ++* | 64 | 72 | 80 | 88 | * ++* ------------------------------------------------- * ++* | R14/LR | R15 | F1 | F3 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 24 | 25 | 26 | 27 | 28 | 29 | | * ++* ------------------------------------------------- * ++* | 96 | 104 | 112 | 120 | * ++* ------------------------------------------------- * ++* | F5 | F7 | PC | | * ++* ------------------------------------------------- * ++* *****************************************************/ ++ ++.file "make_s390x_sysv_elf_gas.S" ++.text ++.align 4 # According to the sample code in the ELF ABI docs ++.global make_fcontext ++.type make_fcontext, @function ++ ++make_fcontext: ++ ++ # make_fcontext takes in 3 arguments ++ # arg1 --> The address where the context needs to be made ++ # arg2 --> The size of the context ++ # arg3 --> The address of the context function ++ ++ # According to the ELF ABI, the register R2 holds the first arg. ++ # R2 also acts as the register which holds return value ++ # Register R3 holds the second, R4 the third so on. ++ ++ # Shift the address in R2 to a lower 8 byte boundary ++ ++ # This is done because according to the ELF ABI Doc, the stack needs ++ # to be 8 byte aligned. ++ # In order to do so, we need to make sure that the address is divisible ++ # by 8. We can check this, by checking if the the last 3 bits of the ++ # address is zero or not. If not AND it with `-8`. ++ ++ # Here we AND the lower 16 bits of the memory address present in the ++ # R2 with the bits 1111 1111 1111 1000 which when converted into ++ # decimal is 65528 ++ nill 2,65528 ++ ++ # Reserve space for context-data on context-stack. ++ # This is done by shifting the SP/address by 112 bytes. ++ lay 2,-120(2) ++ ++ # third arg of make_fcontext() == address of the context-function ++ # Store the address as a PC to jump in, whenever we call the ++ # make_fcontext. ++ stg 4,112(2) ++ ++ # Save the address of finish as return-address for context-function ++ # This will be entered after context-function return ++ # The address of finish will be saved in Link register, this register ++ # specifies where we need to jump after the function executes ++ # completely. ++ larl 1,finish ++ stg 1,64(2) ++ ++ # Return pointer to context data ++ # R14 acts as the link register ++ # R2 holds the address of the context stack. When we return from the ++ # make_fcontext, R2 is passed back. ++ br 14 ++ ++ finish: ++ ++ # In finish tasks, you load the exit code and exit the make_fcontext ++ # This is called when the context-function is entirely executed ++ ++ lghi 2,0 ++ brasl 14,_exit ++ ++.size make_fcontext,.-make_fcontext ++# Mark that we don't need executable stack. ++.section .note.GNU-stack,"",%progbits ++ +diff --git a/src/asm/ontop_s390x_sysv_elf_gas.S b/src/asm/ontop_s390x_sysv_elf_gas.S +new file mode 100644 +index 0000000..7ab2cf5 +--- /dev/null ++++ b/libs/context/src/asm/ontop_s390x_sysv_elf_gas.S +@@ -0,0 +1,143 @@ ++/******************************************************* ++* * ++* ------------------------------------------------- * ++* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++* ------------------------------------------------- * ++* | 0 | 8 | 16 | 24 | * ++* ------------------------------------------------- * ++* | R6 | R7 | R8 | R9 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++* ------------------------------------------------- * ++* | 32 | 40 | 48 | 56 | * ++* ------------------------------------------------- * ++* | R10 | R11 | R12 | R13 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++* ------------------------------------------------- * ++* | 64 | 72 | 80 | 88 | * ++* ------------------------------------------------- * ++* | R14/LR | R15 | F1 | F3 | * ++* ------------------------------------------------- * ++* ------------------------------------------------- * ++* | 24 | 25 | 26 | 27 | 28 | 29 | | * ++* ------------------------------------------------- * ++* | 96 | 104 | 112 | 120 | * ++* ------------------------------------------------- * ++* | F5 | F7 | PC | | * ++* ------------------------------------------------- * ++* *****************************************************/ ++ ++.file "ontop_s390x_sysv_elf_gas.S" ++.text ++.align 4 # According to the sample code in the ELF ABI docs ++.global ontop_fcontext ++.type ontop_fcontext, @function ++ ++ontop_fcontext: ++ ++ # Reserved the space for stack to store the data of current context ++ # before we jump to the new context. ++ lay 15,-120(15) ++ ++ # save the registers to the stack ++ stg 6, 0(15) # save R6 ++ stg 7, 8(15) # save R7 ++ stg 8, 16(15) # save R8 ++ stg 9, 24(15) # save R9 ++ stg 10, 32(15) # save R10 ++ stg 11, 40(15) # save R11 ++ stg 12, 48(15) # save R12 ++ stg 13, 56(15) # save R13 ++ stg 14, 64(15) # save R14 ++ stg 15, 72(15) # save R15 ++ ++ # save the floating point registers ++ # Load the FPR into R0 then save it to the stack ++ # Load F1 into R0 ++ lgdr 0,1 ++ stg 0,80(15) # save F1 ++ ++ # Load F3 into R0 ++ lgdr 0,3 ++ stg 0,88(15) # save F3 ++ ++ # Load F5 into R0 ++ lgdr 0,5 ++ stg 0,96(15) # save F5 ++ ++ # Load F7 into R0 ++ lgdr 0,7 ++ stg 0,104(15) # save F7 ++ ++ # Save LR as PC ++ stg 14,112(15) ++ ++ # Store the SP pointing to the old context-data into R0 ++ lgr 0,15 ++ ++ # Get the SP pointing to the new context-data ++ # Note: Since the return type of the jump_fcontext is struct whose ++ # size is more than 8. The compiler automatically passes the ++ # address of the transfer_t where the data needs to store into R2. ++ ++ # Hence the first param passed to the jump_fcontext which represent ++ # the fctx we want to switch to is present in R3 ++ # R2 --> Address of the return transfer_t struct ++ # R3 --> Context we want to switch to ++ # R4 --> Data ++ lgr 15,3 ++ ++ # Load the registers with the data present in context-data of the ++ # context we are going to switch to ++ lg 6, 0(15) # restore R6 ++ lg 7, 8(15) # restore R7 ++ lg 8, 16(15) # restore R8 ++ lg 9, 24(15) # restore R9 ++ lg 10, 32(15) # restore R10 ++ lg 11, 40(15) # restore R11 ++ lg 12, 48(15) # restore R12 ++ lg 13, 56(15) # restore R13 ++ lg 14, 64(15) # restore R14 ++ lg 15, 72(15) # restore R15 ++ ++ # Restore Floating point registers ++ lg 1,80(15) ++ ldgr 1,1 # restore F1 ++ ++ lg 1,88(15) ++ ldgr 1,3 # restore F3 ++ ++ lg 1,96(15) ++ ldgr 1,5 # restore F5 ++ ++ lg 1,104(15) ++ ldgr 1,7 # restore F7 ++ ++ # Skip PC ++ ++ # Adjust the stack ++ lay 15, 120(15) ++ ++ # R2 --> Address where the return transfer_t is stored ++ # R0 --> FCTX ++ # R4 --> DATA ++ # R5 --> Context function ++ ++ # Store the elements to return transfer_t ++ stg 15, 0(2) ++ stg 4, 8(2) ++ ++ # Note: The address in R2 points to the place where the return ++ # transfer_t is stored. Since context_function take transfer_t ++ # as first parameter. And R2 is the register which holds the ++ # first parameter value. ++ ++ #jump to context function ++ br 5 ++ ++.size ontop_fcontext,.-ontop_fcontext ++# Mark that we don't need executable stack. ++.section .note.GNU-stack,"",%progbits +-- +2.18.1 + diff --git a/SPECS/boost.spec b/SPECS/boost.spec index 399f1cf..71ff355 100644 --- a/SPECS/boost.spec +++ b/SPECS/boost.spec @@ -11,7 +11,7 @@ %bcond_without mpich %bcond_without openmpi -%ifnarch %{ix86} x86_64 ppc64le aarch64 +%ifnarch %{ix86} x86_64 ppc64le aarch64 s390x %bcond_with context %else %bcond_without context @@ -27,7 +27,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.66.0 %global version_enc 1_66_0 -Release: 7%{?dist} +Release: 9%{?dist} License: Boost and MIT and Python %global toplev_dirname %{name}_%{version_enc} @@ -134,6 +134,22 @@ Patch87: boost-1.66.0-numpy3.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1630552 Patch88: boost-1.66-annobin-notes.patch +# https://github.com/boostorg/build/pull/350 +Patch89: boost-1.66-build-malloc-sizeof.patch + +# https://github.com/boostorg/build/pull/351 +Patch90: boost-1.66-build-memory-leak.patch + +# https://github.com/boostorg/graph/pull/84 +Patch91: boost-1.66-graph-return-local-addr.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1782292 +Patch92: boost-1.66-support-s390x-arch.patch +Patch93: boost-1.66-docu-update-architectures.patch +Patch94: boost-1.66-optimize-s390x-instructions.patch +Patch95: boost-1.66-fix-fcontext-routines.patch +Patch96: boost-1.66-build-s390x.patch + %bcond_with tests %bcond_with docs_generated @@ -638,6 +654,14 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x %patch85 -p1 %patch87 -p1 %patch88 -p1 +%patch89 -p1 +%patch90 -p1 +%patch91 -p2 +%patch92 -p1 +%patch93 -p1 +%patch94 -p1 +%patch95 -p1 +%patch96 -p1 %build PYTHON3_ABIFLAGS=$(/usr/bin/python3-config --abiflags) @@ -1297,6 +1321,15 @@ fi %{_mandir}/man1/bjam.1* %changelog +* Fri May 29 2020 Jonathan Wakely - 1.66.0-9 +- Actually apply the patches added to the spec in 1.66.0-8 + +* Fri May 01 2020 Jonathan Wakely - 1.66.0-8 +- Add patches from IBM for s390x support in Boost.Context (#1782292) + +* Fri Jan 31 2020 Jonathan Wakely - 1.66.0-8 +- Add patches to fix covscan defects (#1638070) + * Tue Nov 19 2019 Jonathan Wakely - 1.66.0-7 - Add patch to annotate objects built from assembly code (#1630552)