[packages/boost] - context and coroutine do not build on x32 (added TODO)

baggins baggins at pld-linux.org
Sun Dec 28 20:12:25 CET 2014


commit bab7ef8ca969e8c598729063f919634ad7938680
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Dec 28 19:11:55 2014 +0000

    - context and coroutine do not build on x32 (added TODO)

 boost-x32-context.patch | 85 +++++++++++++++++++++++++++++++++++++++++++++++++
 boost.spec              | 25 +++++++++++++--
 2 files changed, 108 insertions(+), 2 deletions(-)
---
diff --git a/boost.spec b/boost.spec
index 9f33904..b92ee57 100644
--- a/boost.spec
+++ b/boost.spec
@@ -2,6 +2,7 @@
 # TODO:
 #	- think about building MPI.
 #	- split shared libs from core package into -iostreams/-serialization.
+#	- fix building context and corouting on x32 (patch1)
 #
 # Conditional build:
 %bcond_without	python	# without boost-python support
@@ -17,6 +18,7 @@ Group:		Libraries
 Source0:	http://downloads.sourceforge.net/boost/%{name}_%{fver}.tar.bz2
 # Source0-md5:	a744cf167b05d72335f27c88115f211d
 Patch0:		%{name}-link.patch
+Patch1:		%{name}-x32-context.patch
 # FC Patches:
 # https://svn.boost.org/trac/boost/ticket/5637
 Patch203:	%{name}-1.54.0-mpl-print.patch
@@ -395,6 +397,7 @@ Dokumentacja dla biblioteki Boost C++.
 %prep
 %setup -q -n %{name}_%{fver}
 %patch0 -p1
+#patch1 -p0
 
 %patch203 -p0
 %patch211 -p1
@@ -433,10 +436,20 @@ PYTHON_VERSION=
 EXPAT_INCLUDE=%{_includedir} \
 EXPAT_LIBPATH=%{_libdir} \
 ICU_PATH=%{_prefix} \
-./bootstrap.sh --prefix=%{_prefix}
+./bootstrap.sh \
+	--prefix=%{_prefix}
+
 ./b2 \
+%ifarch x32
+	--without-context \
+	--without-coroutine \
+%endif
 	-d2 --toolset=gcc \
-	variant=release debug-symbols=on inlining=on link=static,shared threading=multi
+	variant=release \
+	debug-symbols=on \
+	inlining=on \
+	link=static,shared \
+	threading=multi
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -550,7 +563,9 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libboost_atomic.so.*.*.*
 %attr(755,root,root) %{_libdir}/libboost_container.so.*.*.*
+%ifnarch x32
 %attr(755,root,root) %{_libdir}/libboost_coroutine.so.*.*.*
+%endif
 %attr(755,root,root) %{_libdir}/libboost_iostreams.so.*.*.*
 %attr(755,root,root) %{_libdir}/libboost_math_*.so.*.*.*
 %attr(755,root,root) %{_libdir}/libboost_random.so.*.*.*
@@ -562,8 +577,10 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/libboost_atomic.so
 %attr(755,root,root) %{_libdir}/libboost_chrono.so
 %attr(755,root,root) %{_libdir}/libboost_container.so
+%ifnarch x32
 %attr(755,root,root) %{_libdir}/libboost_context.so
 %attr(755,root,root) %{_libdir}/libboost_coroutine.so
+%endif
 %attr(755,root,root) %{_libdir}/libboost_date_time.so
 %attr(755,root,root) %{_libdir}/libboost_filesystem.so
 %attr(755,root,root) %{_libdir}/libboost_graph.so
@@ -593,8 +610,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libboost_atomic.a
 %{_libdir}/libboost_chrono.a
 %{_libdir}/libboost_container.a
+%ifnarch x32
 %{_libdir}/libboost_context.a
 %{_libdir}/libboost_coroutine.a
+%endif
 %{_libdir}/libboost_date_time.a
 %{_libdir}/libboost_exception.a
 %{_libdir}/libboost_filesystem.a
@@ -638,9 +657,11 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libboost_chrono.so.*.*.*
 
+%ifnarch x32
 %files context
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libboost_context.so.*.*.*
+%endif
 
 %files date_time
 %defattr(644,root,root,755)
diff --git a/boost-x32-context.patch b/boost-x32-context.patch
new file mode 100644
index 0000000..f3f69c8
--- /dev/null
+++ b/boost-x32-context.patch
@@ -0,0 +1,85 @@
+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 @@
+  *                                                                                      *
+  * **************************************************************************************/
+ 
++#ifdef __ILP32__
++# define SIZEOF_FCONTEXT_T 0x50
++#else
++# define SIZEOF_FCONTEXT_T 0x58
++#endif
++
+ .text
+ .globl jump_fcontext
+ .type jump_fcontext, at 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 */
+ 
+-    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 @@
+  *                                                                                      *
+  * **************************************************************************************/
+ 
++#ifdef __ILP32__
++# define SIZEOF_FCONTEXT_T 0x50
++#else
++# define SIZEOF_FCONTEXT_T 0x58
++#endif
++
+ .text
+ .globl make_fcontext
+ .type make_fcontext, at 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
+ 
++#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 */
++#endif
+ 
+     leaq   finish(%rip),    %rcx       /* compute abs address of label finish */
+     movq   %rcx,            (%rdx)     /* save address of finish as return address for context function */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/boost.git/commitdiff/bab7ef8ca969e8c598729063f919634ad7938680



More information about the pld-cvs-commit mailing list