From bfed7e7002fb93c42cad82970861e66ea56f2606 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sun, 7 Jun 2015 11:55:56 +0200 Subject: [PATCH] - cleanup junk in gcc flags - updated x32 context patch --- boost-clean-gcc-flags.patch | 59 +++++++++++++++++++++++ boost-x32-context.patch | 93 +++++++++---------------------------- boost.spec | 20 ++------ 3 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 boost-clean-gcc-flags.patch diff --git a/boost-clean-gcc-flags.patch b/boost-clean-gcc-flags.patch new file mode 100644 index 0000000..d0d52dc --- /dev/null +++ b/boost-clean-gcc-flags.patch @@ -0,0 +1,59 @@ +--- boost_1_58_0/tools/build/src/tools/gcc.jam~ 2015-06-07 11:33:34.000000000 +0200 ++++ boost_1_58_0/tools/build/src/tools/gcc.jam 2015-06-07 11:38:59.720016555 +0200 +@@ -366,9 +366,9 @@ + toolset.flags gcc.compile PCH_FILE on : ; + + # Declare flags and action for compilation. +-toolset.flags gcc.compile OPTIONS off : -O0 ; +-toolset.flags gcc.compile OPTIONS speed : -O3 ; +-toolset.flags gcc.compile OPTIONS space : -Os ; ++toolset.flags gcc.compile OPTIONS off : ; ++toolset.flags gcc.compile OPTIONS speed : ; ++toolset.flags gcc.compile OPTIONS space : ; + + toolset.flags gcc.compile OPTIONS off : -fno-inline ; + toolset.flags gcc.compile OPTIONS on : -Wno-inline ; +@@ -379,8 +379,8 @@ + toolset.flags gcc.compile OPTIONS all : -Wall -pedantic ; + toolset.flags gcc.compile OPTIONS on : -Werror ; + +-toolset.flags gcc.compile OPTIONS on : -g ; +-toolset.flags gcc.compile OPTIONS on : -pg ; ++toolset.flags gcc.compile OPTIONS on : ; ++toolset.flags gcc.compile OPTIONS on : ; + + toolset.flags gcc.compile.c++ OPTIONS off : -fno-rtti ; + toolset.flags gcc.compile.c++ OPTIONS off : -fno-exceptions ; +@@ -448,23 +448,6 @@ + option = -mlp64 ; + } + } +- else +- { +- local arch = [ feature.get-values architecture : $(properties) ] ; +- if $(arch) != arm +- { +- if $(model) = 32 +- { +- option = -m32 ; +- } +- else if $(model) = 64 +- { +- option = -m64 ; +- } +- } +- # For darwin, the model can be 32_64. darwin.jam will handle that +- # on its own. +- } + OPTIONS on $(targets) += $(option) ; + } + } +@@ -1073,7 +1056,7 @@ + # x86 and compatible + # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default. + # Use i686 instead for 32-bit. +-toolset.flags gcc OPTIONS x86/32/ : -march=i686 ; ++toolset.flags gcc OPTIONS x86/32/ : ; + cpu-flags gcc OPTIONS : x86 : native : -march=native ; + cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; + cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; diff --git a/boost-x32-context.patch b/boost-x32-context.patch index f3f69c8..734165f 100644 --- a/boost-x32-context.patch +++ b/boost-x32-context.patch @@ -1,85 +1,38 @@ -Index: libs/context/src/asm/jump_x86_64_sysv_elf_gas.S -=================================================================== ---- libs/context/src/asm/jump_x86_64_sysv_elf_gas.S (revision 86799) -+++ libs/context/src/asm/jump_x86_64_sysv_elf_gas.S (working copy) -@@ -38,6 +38,12 @@ +--- boost_1_58_0/libs/context/src/asm/jump_i386_sysv_elf_gas.S ++++ boost_1_58_0/libs/context/src/asm/jump_i386_sysv_elf_gas.S +@@ -17,6 +17,10 @@ * * - * **************************************************************************************/ + ****************************************************************************************/ -+#ifdef __ILP32__ -+# define SIZEOF_FCONTEXT_T 0x50 ++#ifdef __x86_64__ ++#include "jump_x86_64_sysv_elf_gas.S" +#else -+# define SIZEOF_FCONTEXT_T 0x58 -+#endif + .text .globl jump_fcontext - .type jump_fcontext,@function -@@ -53,11 +59,11 @@ jump_fcontext: - cmp $0, %rcx - je 1f - -- stmxcsr 0x50(%rdi) /* save MMX control and status word */ -- fnstcw 0x54(%rdi) /* save x87 control word */ -+ stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rdi) /* save MMX control and status word */ -+ fnstcw (SIZEOF_FCONTEXT_T - 4)(%rdi) /* save x87 control word */ + .align 2 +@@ -88,3 +92,5 @@ -- ldmxcsr 0x50(%rsi) /* restore MMX control and status word */ -- fldcw 0x54(%rsi) /* restore x87 control word */ -+ ldmxcsr (SIZEOF_FCONTEXT_T - 8)(%rsi) /* restore MMX control and status word */ -+ fldcw (SIZEOF_FCONTEXT_T - 4)(%rsi) /* restore x87 control word */ - 1: - - leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */ -Index: libs/context/src/asm/make_x86_64_sysv_elf_gas.S -=================================================================== ---- libs/context/src/asm/make_x86_64_sysv_elf_gas.S (revision 86799) -+++ libs/context/src/asm/make_x86_64_sysv_elf_gas.S (working copy) -@@ -38,26 +38,43 @@ + /* Mark that we don't need executable stack. */ + .section .note.GNU-stack,"",%progbits ++ ++#endif +--- boost_1_58_0/libs/context/src/asm/make_i386_sysv_elf_gas.S ++++ boost_1_58_0/libs/context/src/asm/make_i386_sysv_elf_gas.S +@@ -17,6 +17,10 @@ * * - * **************************************************************************************/ + ****************************************************************************************/ -+#ifdef __ILP32__ -+# define SIZEOF_FCONTEXT_T 0x50 ++#ifdef __x86_64__ ++#include "make_x86_64_sysv_elf_gas.S" +#else -+# define SIZEOF_FCONTEXT_T 0x58 -+#endif + .text .globl make_fcontext - .type make_fcontext,@function - .align 16 --make_fcontext: -- leaq -0x58(%rdi), %rax /* reserve space for fcontext_t at top of context stack */ -+make_fcontext: // (rax, rsi, rdx) -+ leaq -SIZEOF_FCONTEXT_T(%rdi), %rax /* reserve space for fcontext_t at top of context stack */ - - /* shift address in RAX to lower 16 byte boundary */ - /* == pointer to fcontext_t and address of context stack */ - andq $-16, %rax + .align 2 +@@ -75,3 +79,5 @@ -+#ifdef __ILP32__ -+ mov %edi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */ -+ mov %esi, 0x44(%rax) /* save context stack size in fcontext_t */ -+ mov %edx, 0x38(%rax) /* save address of context function in fcontext_t */ -+#else - movq %rdi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */ - movq %rsi, 0x48(%rax) /* save context stack size in fcontext_t */ - movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */ -+#endif - -- stmxcsr 0x50(%rax) /* save MMX control and status word */ -- fnstcw 0x54(%rax) /* save x87 control word */ -+ stmxcsr (SIZEOF_FCONTEXT_T - 8)(%rax) /* save MMX control and status word */ -+ fnstcw (SIZEOF_FCONTEXT_T - 4)(%rax) /* save x87 control word */ - -+#ifdef __ILP32__ -+ leaq -0x10(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */ -+ mov %edx, 0x30(%rax) /* save address in RDX as stack pointer for context function */ -+#else - leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */ - movq %rdx, 0x30(%rax) /* save address in RDX as stack pointer for context function */ + /* Mark that we don't need executable stack. */ + .section .note.GNU-stack,"",%progbits ++ +#endif - - leaq finish(%rip), %rcx /* compute abs address of label finish */ - movq %rcx, (%rdx) /* save address of finish as return address for context function */ diff --git a/boost.spec b/boost.spec index 239e13e..35ee477 100644 --- a/boost.spec +++ b/boost.spec @@ -20,6 +20,7 @@ Source0: http://downloads.sourceforge.net/boost/%{name}_%{fver}.tar.bz2 # Source0-md5: b8839650e61e9c1c0a89f371dd475546 Patch0: %{name}-link.patch Patch1: %{name}-x32-context.patch +Patch2: %{name}-clean-gcc-flags.patch # FC Patches: # https://svn.boost.org/trac/boost/ticket/5637 Patch203: %{name}-1.54.0-mpl-print.patch @@ -463,7 +464,8 @@ Dokumentacja dla biblioteki Boost C++. %prep %setup -q -n %{name}_%{fver} %patch0 -p1 -#patch1 -p0 +%patch1 -p1 +%patch2 -p1 %patch203 -p0 %patch211 -p1 @@ -472,18 +474,8 @@ Dokumentacja dla biblioteki Boost C++. %patch221 -p1 %patch222 -p1 -# - don't know how to pass it through (b)jam -s (no way?) -# due to oversophisticated build flags system. -# - pass -fPIC due to removal. -%{__sed} -i "s/speed : -O3/speed : ${CXXFLAGS:-%rpmcxxflags} -fPIC/" tools/build/src/tools/gcc.jam - -# cleanup -g switch to avoid override debuginfocflags. -%{__sed} -i 's/on : -g/on :/' tools/build/src/tools/gcc.jam -# link against shared expat library. -#%{__sed} -i 's:find-static:find-shared:' libs/graph/build/Jamfile.v2 - cat << EOF > tools/build/src/user-config.jam -using gcc : %{cxx_version} : %{__cxx} ; +using gcc : %{cxx_version} : %{__cxx} : "%{rpmcflags} -fPIC" "%{rpmcxxflags} -fPIC" "%{rpmldflags}" ; EOF # cleanup backups after patching @@ -498,10 +490,6 @@ ICU_PATH=%{_prefix} \ -without-libraries=python ./b2 \ -%ifarch x32 - --without-context \ - --without-coroutine \ -%endif -d2 --toolset=gcc \ variant=release \ debug-symbols=on \ -- 2.44.0