Bill Allombert on Mon, 06 Jul 2009 12:41:24 +0200


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

Re: bug 828


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/kernel/none/level1.h LINE 109
> FILE ../src/kernel/none/level1.h LINE 86 x is 1
> avma=2147092636 bot=2143092744
> FILE ../src/kernel/none/level1.h LINE 93
> FILE ../src/kernel/none/level1.h LINE 98
> FILE ../src/kernel/none/level1.h LINE 109
> FILE ../src/language/eval.c LINE 715
> avma=2147092632 bot=2143092744
> FILE ../src/language/eval.c LINE 723 65
> FILE ../src/language/eval.c LINE 724
> avma=2147092632 bot=2143092744
> FILE ../src/language/eval.c LINE 723 65
> FILE ../src/language/eval.c LINE 724
> avma=2147092632 bot=2143092744
> FILE ../src/language/eval.c LINE 723 95
> FILE ../src/language/eval.c LINE 724
> FILE ../src/language/eval.c LINE 1073
> FILE ../src/language/eval.c LINE 1074
> avma=2147092632 bot=2143092744
> &avma=0x797bb0 &bot=0x797c40
> ep is 0x113f420
> epval is 0x1a2483a0
> FILE ../src/kernel/none/level1.h LINE 494
> avma=0 bot=0
> &avma=0x1a594918 &bot=0x1a5949a8
> avma=0 bot=0
> FILE ../src/kernel/none/add.c LINE 66
> FILE ../src/kernel/none/add.c LINE 68
> FILE ../src/kernel/none/add.c LINE 70
> FILE ../src/kernel/none/add.c LINE 72
> avma=0 bot=0
> FILE ../src/kernel/none/add.c LINE 75
> avma=0 bot=0
> FILE ../src/kernel/none/mp.c LINE 175
> avma=0 bot=0
> FILE ../src/kernel/none/mp.c LINE 178
> FILE ../src/kernel/none/mp.c LINE 135
> avma=0 bot=0
> avma=0 bot=0
> FILE ../src/kernel/none/level1.h LINE 470
> FILE ../src/kernel/none/level1.h LINE 247
> FILE ../src/kernel/none/level1.h LINE 233
> FILE ../src/kernel/none/level1.h LINE 225
> FILE ../src/kernel/none/level1.h LINE 142
> FILE ../src/kernel/none/level1.h LINE 131
> FILE ../src/kernel/none/level1.h LINE 86 x is 3
> avma=0 bot=0
> FILE ../src/kernel/none/level1.h LINE 89
> FILE ../src/language/init.c LINE 926
> FILE ../src/language/init.c LINE 947
> FILE ../src/language/init.c LINE 834
> 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.