Jason Moxham on Tue, 07 Jul 2009 00:40:52 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: bug 828 |
----- Original Message ----- From: "Bill Allombert" <Bill.Allombert@math.u-bordeaux1.fr>
To: <pari-dev@list.cr.yp.to> Sent: Monday, July 06, 2009 6:07 PM Subject: 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 notmatch as I added a bit debugging stuff FILE ../src/language/init.c LINE 8362 [main] gp-sta 5304 _cygtls::handle_exceptions: Error while dumpingstate (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 http://sourceware.org/ml/cygwin/2004-04/msg00184.html http://sourceware.org/ml/cygwin/2004-04/msg00351.htmlThanks for your link and research. However this does not explain why this workswith gp-dyn. I still wonder what happen when gp-sta is built with -fPIC. Cheers, Bill.
gp-dyn works because avma,bot are defined in the dll not the executible and therefore can be read in another dll.
That my reasoning , whether it is correct or not :) A normal cygwin build gp which is gp-dyn , ends with this/usr/bin/gcc -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -I. -I..
/src/headers -o subfield.o ../src/modules/subfield.c/usr/bin/gcc -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -I. -I..
/src/headers -o thue.o ../src/modules/thue.c rm -f libpari-gmp-2.4.dll/usr/bin/gcc -o "/cygdrive/c/Users/jasonadmin/parisvncygwinpic/Ocygwin-i686"/li
bpari-gmp-2.4.dll -shared -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer-Wl,--out-implib=libpari.dll.a,--export-all-symbols mp.o mpinl.o F2x.o FF.o F lx.o FpE.o FpV.o FpX.o Qfb.o RgV.o RgX.o ZV.o ZX.o alglin1.o alglin2.o arith1.o arith2.o base1.o base2.o base3.o base4.o base5.o bb_group.o bibli1.o bibli2.o bi t.o buch1.o buch2.o buch3.o buch4.o concat.o elliptic.o galconj.o gen1.o gen2.o gen3.o hnf_snf.o ifactor1.o lll.o perm.o polarit1.o polarit2.o polarit3.o prime. o random.o rootpol.o subcyclo.o subgroup.o trans1.o trans2.o trans3.o anal.o com pat.o compile.o default.o errmsg.o es.o eval.o hash.o init.o intnum.o members.o pariinl.o sumiter.o parse.o DedekZeta.o Hensel.o QX_factor.o aprcl.o elldata.o e llsea.o galois.o galpol.o groupid.o kummer.o mpqs.o nffactor.o part.o stark.o su
bfield.o thue.o -lc -lm -L/usr/local/lib -lgmp Creating library file: libpari.dll.aif test "libpari-gmp-2.4.dll" != "libpari.dll"; then rm -f libpari.dll; ln
-s libpari-gmp-2.4.dll libpari.dll; fiif test "libpari-gmp-2.4.dll" != "libpari-gmp-2.4.dll"; then rm -f libpari-
gmp-2.4.dll; ln -s libpari-gmp-2.4.dll libpari-gmp-2.4.dll; fi rm -f gp-dyn/usr/bin/gcc -o dyn -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer - Wl,--export-dynamic gp.o gp_init.o gp_rl.o highlvl.o whatnow.o plotport.o plotn
ull.o -Wl,-rpath,"/cygdrive/c/Users/jasonadmin/parisvncygwinpic"/Ocygwin-i686:"/ usr/local/lib":/usr/local/lib:/lib:/usr/lib -L"/cygdrive/c/Users/jasonadmin/pari svncygwinpic/Ocygwin-i686" -L/lib -lreadline -L/lib -lncurses -L"/usr/local/lib" -lpari -lm/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: warning: au to-importing has been activated without --enable-auto-import specified on the co
mmand line.This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.Info: resolving _GP_DATA by linking to __imp__GP_DATA (
auto-import)Info: resolving _PARI_SIGINT_block by linking to __imp__PARI_SIGINT_block (auto-
import)Info: resolving _PARI_SIGINT_pending by linking to __imp__PARI_SIGINT_pending (a
uto-import)Info: resolving _functions_tblsz by linking to __imp__functions_tblsz (auto-impo
rt)Info: resolving _functions_hash by linking to __imp__functions_hash (auto-import
) Info: resolving _DEBUGMEM by linking to __imp__DEBUGMEM (auto-import)Info: resolving _cb_pari_whatnow by linking to __imp__cb_pari_whatnow (auto-impo
rt) Info: resolving _avma by linking to __imp__avma (auto-import)Info: resolving _rl_library_version by linking to __imp__rl_library_version (aut
o-import)Info: resolving _disable_color by linking to __imp__disable_color (auto-import)
Info: resolving _gp_colors by linking to __imp__gp_colors (auto-import) Info: resolving _logstyle by linking to __imp__logstyle (auto-import)Info: resolving _pari_logfile by linking to __imp__pari_logfile (auto-import)
Info: resolving _compatible by linking to __imp__compatible (auto-import) Info: resolving _pari_infile by linking to __imp__pari_infile (auto-import)Info: resolving _pari_outfile by linking to __imp__pari_outfile (auto-import)
Info: resolving _bot by linking to __imp__bot (auto-import) Info: resolving _top by linking to __imp__top (auto-import)Info: resolving _current_logfile by linking to __imp__current_logfile (auto-impo
rt) Info: resolving _win32ctrlc by linking to __imp__win32ctrlc (auto-import) Info: resolving _gnil by linking to __imp__gnil (auto-import)Info: resolving _global_err_data by linking to __imp__global_err_data (auto-impo
rt)Info: resolving _cb_pari_handle_exception by linking to __imp__cb_pari_handle_ex
ception (auto-import)Info: resolving _cb_pari_sigint by linking to __imp__cb_pari_sigint (auto-import
)Info: resolving _cb_pari_ask_confirm by linking to __imp__cb_pari_ask_confirm (a
uto-import) Info: resolving _gen_0 by linking to __imp__gen_0 (auto-import) Info: resolving _precdl by linking to __imp__precdl (auto-import) Info: resolving _LOG2_10 by linking to __imp__LOG2_10 (auto-import) Info: resolving _precreal by linking to __imp__precreal (auto-import)Info: resolving _rl_last_func by linking to __imp__rl_last_func (auto-import)
Info: resolving _rl_point by linking to __imp__rl_point (auto-import)Info: resolving _readline_state by linking to __imp__readline_state (auto-import
)Info: resolving _rl_line_buffer by linking to __imp__rl_line_buffer (auto-import
) Info: resolving _rl_end by linking to __imp__rl_end (auto-import)Info: resolving _rl_completion_append_character by linking to __imp__rl_completi
on_append_character (auto-import)Info: resolving _oldfonctions by linking to __imp__oldfonctions (auto-import) Info: resolving _gp_default_list by linking to __imp__gp_default_list (auto-impo
rt)Info: resolving _rl_outstream by linking to __imp__rl_outstream (auto-import) Info: resolving _rl_basic_word_break_characters by linking to __imp__rl_basic_wo
rd_break_characters (auto-import)Info: resolving _rl_readline_name by linking to __imp__rl_readline_name (auto-im
port)Info: resolving _rl_special_prefixes by linking to __imp__rl_special_prefixes (a
uto-import)Info: resolving _rl_attempted_completion_function by linking to __imp__rl_attemp
ted_completion_function (auto-import)Info: resolving _rl_completion_query_items by linking to __imp__rl_completion_qu
ery_items (auto-import)Info: resolving _emacs_meta_keymap by linking to __imp__emacs_meta_keymap (auto-
import)Info: resolving _vi_movement_keymap by linking to __imp__vi_movement_keymap (aut
o-import)Info: resolving _emacs_standard_keymap by linking to __imp__emacs_standard_keyma
p (auto-import)Info: resolving _history_length by linking to __imp__history_length (auto-import
)Info: resolving _pari_colormap by linking to __imp__pari_colormap (auto-import) Info: resolving _pari_graphcolors by linking to __imp__pari_graphcolors (auto-im
port)Info: resolving _current_psfile by linking to __imp__current_psfile (auto-import
) Info: resolving _gen_1 by linking to __imp__gen_1 (auto-import) rm -f ../gp.exe ln -s Ocygwin-i686/gp-dyn.exe ../gp.exemake[1]: Leaving directory `/cygdrive/c/Users/jasonadmin/parisvncygwinpic/Ocygwi
n-i686' Now makeing bench to get the static version of gp $ make bench Making bench in Ocygwin-i686make[1]: Entering directory `/cygdrive/c/Users/jasonadmin/parisvncygwinpic/Ocygw
in-i686' File ../src/funclist not changed. rm -f gp-sta/usr/bin/gcc -o sta -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer - Wl,--export-dynamic mp.o mpinl.o F2x.o FF.o Flx.o FpE.o FpV.o FpX.o Qfb.o RgV.o RgX.o ZV.o ZX.o alglin1.o alglin2.o arith1.o arith2.o base1.o base2.o base3.o b ase4.o base5.o bb_group.o bibli1.o bibli2.o bit.o buch1.o buch2.o buch3.o buch4. o concat.o elliptic.o galconj.o gen1.o gen2.o gen3.o hnf_snf.o ifactor1.o lll.o perm.o polarit1.o polarit2.o polarit3.o prime.o random.o rootpol.o subcyclo.o su bgroup.o trans1.o trans2.o trans3.o anal.o compat.o compile.o default.o errmsg.o es.o eval.o hash.o init.o intnum.o members.o pariinl.o sumiter.o parse.o DedekZ eta.o Hensel.o QX_factor.o aprcl.o elldata.o ellsea.o galois.o galpol.o groupid. o kummer.o mpqs.o nffactor.o part.o stark.o subfield.o thue.o gp.o gp_init.o gp_ rl.o highlvl.o whatnow.o plotport.o plotnull.o -Wl,-rpath,"/cygdrive/c/Users/jas
onadmin/parisvncygwinpic"/Ocygwin-i686:"/usr/local/lib":/usr/local/lib:/lib:/usr /lib -L/lib -lreadline -L/lib -lncurses -L/usr/local/lib -lgmp -lm/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: warning: au to-importing has been activated without --enable-auto-import specified on the co
mmand line.This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.Info: resolving _rl_library_version by linking to __imp
__rl_library_version (auto-import)Info: resolving _rl_last_func by linking to __imp__rl_last_func (auto-import)
Info: resolving _rl_point by linking to __imp__rl_point (auto-import)Info: resolving _rl_line_buffer by linking to __imp__rl_line_buffer (auto-import
) Info: resolving _rl_end by linking to __imp__rl_end (auto-import)Info: resolving _rl_completion_append_character by linking to __imp__rl_completi
on_append_character (auto-import)Info: resolving _rl_outstream by linking to __imp__rl_outstream (auto-import) Info: resolving _rl_basic_word_break_characters by linking to __imp__rl_basic_wo
rd_break_characters (auto-import)Info: resolving _rl_readline_name by linking to __imp__rl_readline_name (auto-im
port)Info: resolving _rl_special_prefixes by linking to __imp__rl_special_prefixes (a
uto-import)Info: resolving _rl_attempted_completion_function by linking to __imp__rl_attemp
ted_completion_function (auto-import)Info: resolving _rl_completion_query_items by linking to __imp__rl_completion_qu
ery_items (auto-import)Info: resolving _emacs_meta_keymap by linking to __imp__emacs_meta_keymap (auto-
import)Info: resolving _vi_movement_keymap by linking to __imp__vi_movement_keymap (aut
o-import)Info: resolving _emacs_standard_keymap by linking to __imp__emacs_standard_keyma
p (auto-import)Info: resolving _history_length by linking to __imp__history_length (auto-import
) Trying it with -fPIC make no difference , still get same test failures Jason