|
Boost : |
Subject: Re: [boost] [context review] Several Questions
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2011-03-21 18:55:24
>>> a) (BIG ONE) The shared object link using fcontext crashes!
>>>
>>> Using boost_1_46_0
>> boost-1.46 not tested - use 1.45, please
> Sorry, I can't accept this, also because crash happens
> inside boost_context function I don't think it is related
> to 1.45 / 1.46 differences
>
could you please so kind to get my working tree?
git clone git://git.gitorious.org/boost-dev/boost-dev.git
It would help that we are using the same code basis.
>>> Building boost_context:
>>>
>>> bjam toolset=gcc context-impl=asm architecture=x86
>> instruction-set=native
>>> address-model=64 --with-context
>>> variant=release stage
>> which platform i386? Into the documention I provide for all the platforms
>> (arm, i386, x86_64, mips, ppc) the bjam-options you have to used.
>> - for x86 64bit: bjam toolset=gcc architecture=x86 instruction-set=yorksfield
>> address-model=64 context-impl=asm
>>
>>> Then I compile example link.cpp
>>>
>>> Run it
>>>
>>> It crashes!
>>>
>> not in my test
>>
> Unfortunately it is not so good answer :-)
;-) I'm a little bit surprised because it worked and I tried it on
several intel computers. But I've an idea because if I use your
cammandline buildinglink.cpp I get an segfault too.
g++ -g link.cpp -I /opt/boost/include/ -L /opt/boost/lib/
-Wl,-rpath=/opt/boost/lib -lboost_context -lrt
segfault at get_fcontext ()
This is because you are missing -fPIC option. On x86_64 the code is
build position independent.
g++ -g link.cpp -I /opt/boost/include/ -L /opt/boost/lib/
-Wl,-rpath=/opt/boost/lib -lboost_context -lrt -fPIC
-> works
I think it is better to build the examples with bjam. That means:
1.) got to <boost-root>/libs/context/examples
2.) compile the examples: bjam toolset=gcc architecture=x86
instruction-set=native address-model=64 context-impl=asm
3.) test the examples in
<boost-root>/bin.v2/libs/context/example/gcc-4.4.5/release/address-model-64/architecture-x86/context-impl-asm/instruction-set-native/link-static/
or if Jamvile.v2 was modified to use link against shared lib (<link>shared)
<boost-root>/bin.v2/libs/context/example/gcc-4.4.5/release/address-model-64/architecture-x86/context-impl-asm/instruction-set-native/
>> Do mean why you can specify to use the context swapping provided by the
>> Operating System or the assembler code (==fcontext)?
> I mean something like
>
> boost::context<> // some default
> boost::ucontext<>
> boost::fcontext<>
>
> So you can have two implementations in same code.
>
This is a option too - my previous intention was to hide this for the
user. At the time the boost-libs are compiled the user decides if it
wants the fast version or the UNIX signal safe version.
It is also hard to provide boost:.fcontext<> for all platforms - for
instance on MIPS I would have to implement 4 version of fcontext
(because of the multiple MIPS ABIs).
Oliver
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk