Bill Allombert on Mon, 06 Jul 2009 19:14:04 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: bug 828

On Mon, Jul 06, 2009 at 03:40:36PM +0100, Jason Moxham wrote:
>> On Mon, Jul 06, 2009 at 02:22:01AM +0100, Jason Moxham wrote:
>>> Hi
>>> I've been looking at bug 828  dynamic loading of a function in a static
>>> build of pari.
>>> Here is a guess based on my debug below , note the line numbers will not
>>> match as I added a bit debugging stuff
>>> FILE ../src/language/init.c LINE 836
>>>      2 [main] gp-sta 5304 _cygtls::handle_exceptions: Error while dumping
>>> state
>>> (probably corrupted stack)
>>> Segmentation fault (core dumped)
>>> It look like that when you load up the function addii from the dynamic
>>> library it also loads up another copy of the varibles avma and bot ,
>>> which are then accessed and of course the values they have are garbage.
>> Interesting. What are exactly the linker flags used ?
>> There are probably some linker flags that could fix that.
>> Could you try to rebuild everything with -fPIC ? This cahnges the way
>> global variables are linked, so it might make a difference here.
>> Cheers,
>> Bill.
>> -------------------------------------------------------
> If I'm reading this correctly there is no solution. Windows(and 
> apparently some form of BSD) does not support functions in a dll reading 
> global varibles in the original executible. Therefore our static build 
> will never work in windows and we should disable that part of the test 
> for windows. It works in the shared case as a dll can read a varible in 
> another dll.
> follow the the long threads below

Thanks for your link and research. However this does not explain why this works
with gp-dyn. I still wonder what happen when gp-sta is built with -fPIC.