On Aug 25, 3:41 am, Jason Moxham <ja...@njkfrudils.plus.com> wrote:

> can you post me a list , there may be also mpn_* mpf_* __gmp_*  etc , I think
> we will have to find ALL of them .

The experiment I did indicates that the libecl.so I created did *not*
have the property that I wanted:

1) sage is using gmp.so and is linked to that before libecl.so is even
introduced. Thus, presumably sage is fully bound to libecl.so
2) sage initializes some of its "gmp integer pool"
3) upon "from sage.libs.ecl import *" I think libecl.so is "dlopen"-ed
by sage (or does that happen before the integer pool is created?)
4) cl_boot() in libecl.so calls mp_set_memory_functions to set the
memory functions, presumably on the copy of libgmp.a that has been
included in the build of libecl.so (libecl.so is certainly not
advertising any dependencies on libgmp.so when I call ldd on it).
5) I exit sage and get a segfault. The stack trace shows that
free_integer_pool called ecl_dealloc. This is evidence that cl_boot
called the mp_set_memory_functions that sage itself uses as well.

Is the fact that "ldd libecl.so" does not show libgmp.so a guarantee
that libecl.so will be using the mp_set_memory_functions from the
libgmp.a that it was linked with? In that case, apparently sage does
link in libecl.so upon startup and for some silly reason prefers the
gmp symbols from libecl.so rather than from libgmp.so. In that case,
preventing symbols from leaking might solve the problem. I executed
the following, but you should check your manpage to see if "objdump -
T" indeed lists the right symbols.

objdump -T libgmp.so | awk " { print $ 7 } " | sort | uniq >
gmp.symbols
objdump -T libecl.so | awk " { print $ 7 } " | sort | uniq >
ecl.symbols

There are 230 symbols that occur both in libgmp.so and in libecl.so
There are 325 symbols that occur in libgmp.so but not in libecl.so

using python:

F=open("gmp.symbols")
gmp=[l[:-1] for l  in F]
F=open("ecl.symbols")
ecl=[l[:-1] for l in F]

[l for l in gmp if (l in ecl)]
"['__bss_start', '__cxa_finalize', '_edata', '_end', '_fini',
'__gmp_0', '__gmp_allocate_func', '__gmp_assert_fail',
'__gmp_assert_header', '__gmp_bits_per_limb',
'__gmp_default_allocate', '__gmp_default_free',
'__gmp_default_reallocate', '__gmp_divide_by_zero', '__gmp_errno',
'__gmp_exception', '__gmp_extract_double', '__gmp_free_func',
'__gmp_invalid_operation', '__gmp_junk', '__gmp_modlimb_invert_table',
'__gmpn_add', '__gmpn_addadd_n', '__gmpn_addlsh1_n',
'__gmpn_addmul_1', '__gmpn_add_n', '__gmpn_addsub_n', '__gmpn_and_n',
'__gmpn_bases', '__gmpn_bdivmod', '__gmpn_bgcd_matrix_init',
'__gmpn_com_n', '__gmpn_copyd', '__gmpn_copyi', '__gmpn_dc_divrem_n',
'__gmpn_divexact_1', '__gmpn_divexact_by3c',
'__gmpn_divexact_byBm1of', '__gmpn_divrem_1',
'__gmpn_divrem_euclidean_qr_1', '__gmpn_divrem_euclidean_qr_2',
'__gmpn_fft_best_k', '__gmpn_fft_next_size', '__gmpn_gcd',
'__gmpn_gcd_1', '__gmpn_get_d', '__gmpn_hbgcd_n',
'__gmpn_hbgcd_n_itch', '__gmpn_hgcd', '__gmpn_hgcd2',
'__gmpn_hgcd2_fix', '__gmpn_hgcd2_lehmer_step', '__gmpn_hgcd_fix',
'__gmpn_hgcd_init', '__gmpn_hgcd_init_itch', '__gmpn_hgcd_itch',
'__gmpn_hgcd_max_recursion', '__gmpn_kara_mul_n', '__gmpn_kara_sqr_n',
'__gmpn_lgcd', '__gmpn_lshift', '__gmpn_lshift1',
'__gmpn_modexact_1c_odd', '__gmpn_modexact_1_odd', '__gmpn_mul',
'__gmpn_mul_1', '__gmpn_mul_2', '__gmpn_mul_basecase',
'__gmpn_mul_fft', '__gmpn_mul_fft_full', '__gmpn_mul_n',
'__gmpn_ngcd_lehmer', '__gmpn_ngcd_matrix1_vector',
'__gmpn_ngcd_matrix_adjust', '__gmpn_ngcd_matrix_init',
'__gmpn_ngcd_matrix_mul', '__gmpn_ngcd_step',
'__gmpn_ngcd_subdiv_step', '__gmpn_nhgcd', '__gmpn_nhgcd_itch',
'__gmpn_popcount', '__gmpn_rsh1add_n', '__gmpn_rsh1sub_n',
'__gmpn_rshift', '__gmpn_rshift1', '__gmpn_sb_divrem_mn',
'__gmpn_sqr_basecase', '__gmpn_sqr_n', '__gmpn_store', '__gmpn_sub',
'__gmpn_subadd_n', '__gmpn_submul_1', '__gmpn_sub_n',
'__gmpn_sumdiff_n', '__gmpn_tdiv_qr', '__gmpn_toom32_mul',
'__gmpn_toom3_interpolate', '__gmpn_toom3_mul', '__gmpn_toom3_mul_n',
'__gmpn_toom3_sqr_n', '__gmpn_toom42_mul', '__gmpn_toom4_mul_n',
'__gmpn_toom4_sqr_n', '__gmpn_toom7_mul_n', '__gmpn_toom7_sqr_n',
'__gmpq_clear', '__gmpq_get_d', '__gmpq_init',
'__gmp_reallocate_func', '__gmp_set_memory_functions',
'__gmp_sqrt_of_negative', '__gmp_tmp_reentrant_alloc',
'__gmp_tmp_reentrant_free', '__gmpz_add', '__gmpz_add_ui',
'__gmpz_and', '__gmpz_cdiv_q_2exp', '__gmpz_cdiv_qr', '__gmpz_cmp',
'__gmpz_cmp_si', '__gmpz_com', '__gmpz_fdiv_q_2exp', '__gmpz_fdiv_qr',
'__gmpz_fits_slong_p', '__gmpz_gcd', '__gmpz_get_d', '__gmpz_get_si',
'__gmpz_init2', '__gmpz_init_set', '__gmpz_init_set_si',
'__gmpz_init_set_ui', '__gmpz_ior', '__gmpz_mul', '__gmpz_mul_2exp',
'__gmpz_mul_si', '__gmpz_mul_ui', '__gmpz_realloc', '__gmpz_set',
'__gmpz_set_d', '__gmpz_set_si', '__gmpz_sizeinbase', '__gmpz_sub',
'__gmpz_sub_ui', '__gmpz_tdiv_q', '__gmpz_tdiv_qr',
'__gmpz_tdiv_q_ui', '__gmpz_tstbit', '__gmpz_xor', '_init',
'mpn_addadd_n', 'mpn_addlsh1_n', 'mpn_addmul_1', 'mpn_add_n',
'mpn_addsub_n', 'mpn_and_n', 'mpn_basic_gcd', 'mpn_bgcd', 'mpn_com_n',
'mpn_copyd', 'mpn_copyi', 'mpn_divexact_by3c', 'mpn_divexact_byBm1of',
'mpn_divrem_euclidean_qr_1', 'mpn_divrem_euclidean_qr_2',
'mpn_fft_best_a', 'mpn_hgcd_quotients_init',
'mpn_hgcd_quotients_init_itch', 'mpn_lshift', 'mpn_lshift1',
'mpn_modexact_1c_odd', 'mpn_modexact_1_odd', 'mpn_mul_1', 'mpn_mul_2',
'mpn_mul_basecase', 'mpn_mul_fft_aux', 'mpn_mul_fft_full_a',
'mpn_mul_fft_mersenne', 'mpn_ngcd', 'mpn_nhgcd2', 'mpn_rgcd',
'mpn_rsh1add_n', 'mpn_rsh1sub_n', 'mpn_rshift', 'mpn_rshift1',
'mpn_sgcd', 'mpn_sqr_basecase', 'mpn_store', 'mpn_subadd_n',
'mpn_submul_1', 'mpn_sub_n', 'mpn_sumdiff_n', 'mpz_bgcd', 'mpz_lgcd',
'mpz_ngcd', 'mpz_rgcd', 'mpz_sgcd', '_tc4_add', 'tc4_add',
'tc4_addlsh1_unsigned', 'tc4_addmul_1', '_tc4_add_unsigned',
'tc4_add_unsigned', 'tc4_copy', 'tc4_divexact_by3', 'tc4_divexact_ui',
'tc4_lshift', 'tc4_rshift_inplace', 'tc4_sub', 'tc4_submul_1',
'tc4_sumdiff', 'tc4_sumdiff_unsigned', '_tc7_add', 'tc7_add',
'tc7_addlsh1_unsigned', 'tc7_addmul_1', '_tc7_add_unsigned',
'tc7_add_unsigned', 'tc7_copy', 'tc7_divexact_1', 'tc7_divexact_by3',
'tc7_lshift', 'tc7_mul_1', 'tc7_rshift_inplace', 'tc7_sub',
'tc7_submul_1', 'tc7_sumdiff', 'tc7_sumdiff_unsigned',
'toom4_interpolate', 'toom7_interpolate']"

[l for l in gmp if not(l in ecl)]
"['gcdext_get_t', '__gmp_asprintf', '__gmp_asprintf_final',
'__gmp_asprintf_funs', '__gmp_asprintf_memory', '__gmp_asprintf_reps',
'__gmp_default_fp_limb_precision', '__gmp_digit_value_tab',
'__gmp_doprnt', '__gmp_doprnt_integer', '__gmp_doprnt_mpf2',
'__gmp_doscan', '__gmpf_abs', '__gmpf_add', '__gmpf_add_ui',
'__gmpf_ceil', '__gmpf_clear', '__gmpf_cmp', '__gmpf_cmp_d',
'__gmpf_cmp_si', '__gmpf_cmp_ui', '__gmpf_div', '__gmpf_div_2exp',
'__gmpf_div_ui', '__gmpf_dump', '__gmpf_eq', '__gmpf_fits_sint_p',
'__gmpf_fits_slong_p', '__gmpf_fits_sshort_p', '__gmpf_fits_uint_p',
'__gmpf_fits_ulong_p', '__gmpf_fits_ushort_p', '__gmpf_floor',
'__gmpf_get_d', '__gmpf_get_d_2exp', '__gmpf_get_default_prec',
'__gmpf_get_prec', '__gmpf_get_si', '__gmpf_get_str', '__gmpf_get_ui',
'__gmp_fib_table', '__gmpf_init', '__gmpf_init2', '__gmpf_init_set',
'__gmpf_init_set_d', '__gmpf_init_set_si', '__gmpf_init_set_str',
'__gmpf_init_set_ui', '__gmpf_inp_str', '__gmpf_integer_p',
'__gmpf_mul', '__gmpf_mul_2exp', '__gmpf_mul_ui', '__gmpf_neg',
'__gmpf_out_str', '__gmpf_pow_ui', '__gmp_fprintf',
'__gmp_fprintf_funs', '__gmpf_random2', '__gmpf_reldiff',
'__gmp_fscanf', '__gmp_fscanf_funs', '__gmpf_set', '__gmpf_set_d',
'__gmpf_set_default_prec', '__gmpf_set_prec', '__gmpf_set_prec_raw',
'__gmpf_set_q', '__gmpf_set_si', '__gmpf_set_str', '__gmpf_set_ui',
'__gmpf_set_z', '__gmpf_size', '__gmpf_sqrt', '__gmpf_sqrt_ui',
'__gmpf_sub', '__gmpf_sub_ui', '__gmpf_swap', '__gmpf_trunc',
'__gmpf_ui_div', '__gmpf_ui_sub', '__gmpf_urandomb',
'__gmp_get_memory_functions', '__gmp_mt_recalc_buffer',
'__gmpn_add_1', '__gmpn_addmul_2', '__gmpn_andn_n',
'__gmpn_basic_gcdext', '__gmpn_cmp', '__gmpn_divexact_byff',
'__gmpn_divisible_p', '__gmpn_divmod_1', '__gmpn_divrem',
'__gmpn_divrem_2', '__gmpn_divrem_euclidean_r_1', '__gmpn_dump',
'__gmpn_fib2_ui', '__gmpn_gcdext', '__gmpn_get_str', '__gmpn_hamdist',
'__gmpn_ior_n', '__gmpn_iorn_n', '__gmpn_jacobi_base', '__gmpn_mod_1',
'__gmpn_mod_34lsub1', '__gmpn_mullow_basecase', '__gmpn_mullow_n',
'__gmpn_nand_n', '__gmpn_nior_n', '__gmpn_perfect_square_p',
'__gmpn_pow_1', '__gmpn_preinv_mod_1', '__gmpn_random',
'__gmpn_random2', '__gmpn_redc_basecase', '__gmpn_rootrem',
'__gmpn_scan0', '__gmpn_scan1', '__gmpn_set_str', '__gmpn_sqrtrem',
'__gmpn_sub_1', '__gmpn_sublsh1_n', '__gmpn_udiv_qrnnd',
'__gmpn_umul_ppmm', '__gmpn_xnor_n', '__gmpn_xor_n',
'__gmp_obstack_printf', '__gmp_obstack_printf_funs',
'__gmp_obstack_vprintf', '__gmp_printf', '__gmpq_abs', '__gmpq_add',
'__gmpq_canonicalize', '__gmpq_cmp', '__gmpq_cmp_si', '__gmpq_cmp_ui',
'__gmpq_div', '__gmpq_div_2exp', '__gmpq_equal', '__gmpq_get_den',
'__gmpq_get_num', '__gmpq_get_str', '__gmpq_inp_str', '__gmpq_inv',
'__gmpq_mul', '__gmpq_mul_2exp', '__gmpq_neg', '__gmpq_out_str',
'__gmpq_set', '__gmpq_set_d', '__gmpq_set_den', '__gmpq_set_f',
'__gmpq_set_num', '__gmpq_set_si', '__gmpq_set_str', '__gmpq_set_ui',
'__gmpq_set_z', '__gmpq_sub', '__gmpq_swap', '__gmp_randclear',
'__gmp_randclear_mt', '__gmp_randget_mt', '__gmp_randinit',
'__gmp_randinit_default', '__gmp_randinit_lc_2exp',
'__gmp_randinit_lc_2exp_size', '__gmp_randinit_mt',
'__gmp_randinit_mt_noseed', '__gmp_randinit_set', '__gmp_randiset_mt',
'__gmp_rands', '__gmp_randseed', '__gmp_randseed_ui',
'__gmp_rands_initialized', '__gmp_scanf', '__gmp_snprintf',
'__gmp_snprintf_funs', '__gmp_sprintf', '__gmp_sprintf_funs',
'__gmp_sscanf', '__gmp_sscanf_funs', '__gmp_urandomb_ui',
'__gmp_urandomm_ui', '__gmp_vasprintf', '__gmp_version',
'__gmp_vfprintf', '__gmp_vfscanf', '__gmp_vprintf', '__gmp_vscanf',
'__gmp_vsnprintf', '__gmp_vsprintf', '__gmp_vsscanf', '__gmpz_abs',
'__gmpz_addmul', '__gmpz_addmul_ui', '__gmpz_aorsmul_1',
'__gmpz_array_init', '__gmpz_bin_ui', '__gmpz_bin_uiui',
'__gmpz_cdiv_q', '__gmpz_cdiv_qr_ui', '__gmpz_cdiv_q_ui',
'__gmpz_cdiv_r', '__gmpz_cdiv_r_2exp', '__gmpz_cdiv_r_ui',
'__gmpz_cdiv_ui', '__gmpz_clear', '__gmpz_clrbit', '__gmpz_cmpabs',
'__gmpz_cmpabs_d', '__gmpz_cmpabs_ui', '__gmpz_cmp_d',
'__gmpz_cmp_ui', '__gmpz_combit', '__gmpz_congruent_2exp_p',
'__gmpz_congruent_p', '__gmpz_congruent_ui_p', '__gmpz_divexact',
'__gmpz_divexact_gcd', '__gmpz_divexact_ui',
'__gmpz_divisible_2exp_p', '__gmpz_divisible_p',
'__gmpz_divisible_ui_p', '__gmpz_dump', '__gmpz_export',
'__gmpz_fac_ui', '__gmpz_fdiv_q', '__gmpz_fdiv_qr_ui',
'__gmpz_fdiv_q_ui', '__gmpz_fdiv_r', '__gmpz_fdiv_r_2exp',
'__gmpz_fdiv_r_ui', '__gmpz_fdiv_ui', '__gmpz_fib2_ui',
'__gmpz_fib_ui', '__gmpz_fits_sint_p', '__gmpz_fits_sshort_p',
'__gmpz_fits_uint_p', '__gmpz_fits_ulong_p', '__gmpz_fits_ushort_p',
'__gmpz_gcdext', '__gmpz_gcd_ui', '__gmpz_get_d_2exp',
'__gmpz_getlimbn', '__gmpz_get_str', '__gmpz_get_ui',
'__gmpz_hamdist', '__gmpz_import', '__gmpz_init', '__gmpz_init_set_d',
'__gmpz_init_set_str', '__gmpz_inp_raw', '__gmpz_inp_str',
'__gmpz_inp_str_nowhite', '__gmpz_invert', '__gmpz_jacobi',
'__gmpz_kronecker_si', '__gmpz_kronecker_ui', '__gmpz_lcm',
'__gmpz_lcm_ui', '__gmpz_legendre', '__gmpz_lucnum2_ui',
'__gmpz_lucnum_ui', '__gmpz_millerrabin', '__gmpz_mod', '__gmpz_neg',
'__gmpz_nextprime', '__gmpz_n_pow_ui', '__gmpz_out_raw',
'__gmpz_out_str', '__gmpz_perfect_power_p', '__gmpz_perfect_square_p',
'__gmpz_popcount', '__gmpz_powm', '__gmpz_powm_ui', '__gmpz_pow_ui',
'__gmpz_probab_prime_p', '__gmpz_random', '__gmpz_random2',
'__gmpz_realloc2', '__gmpz_remove', '__gmpz_root', '__gmpz_rootrem',
'__gmpz_rrandomb', '__gmpz_scan0', '__gmpz_scan1', '__gmpz_setbit',
'__gmpz_set_f', '__gmpz_set_q', '__gmpz_set_str', '__gmpz_set_ui',
'__gmpz_si_kronecker', '__gmpz_size', '__gmpz_sqrt', '__gmpz_sqrtrem',
'__gmpz_submul', '__gmpz_submul_ui', '__gmpz_swap',
'__gmpz_tdiv_q_2exp', '__gmpz_tdiv_qr_ui', '__gmpz_tdiv_r',
'__gmpz_tdiv_r_2exp', '__gmpz_tdiv_r_ui', '__gmpz_tdiv_ui',
'__gmpz_ui_kronecker', '__gmpz_ui_pow_ui', '__gmpz_ui_sub',
'__gmpz_urandomb', '__gmpz_urandomm', '__mpir_version',
'mpn_addmul_2', 'mpn_andn_n', 'mpn_divexact_byff', 'mpn_ior_n',
'mpn_iorn_n', 'mpn_nand_n', 'mpn_ngcdext_subdiv_step', 'mpn_nior_n',
'mpn_redc_basecase', 'mpn_sublsh1_n', 'mpn_udiv_qrnnd',
'mpn_umul_ppmm', 'mpn_xnor_n', 'mpn_xor_n',
'ngcdext_cofactor_adjust']"

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to