I realize this is only partially libtool related, but I figured
that this is probably a good forum for this question.
I have a shared library built with libtool, in which there is
a module that is roughly defined as so:
static int function_0 (int arg1);
static int function_1 (int arg1);
static int function_2 (int arg1);
static int function_3 (int arg1);
typedef int (funcptr) (int arg1);
static funcptr *sg_func_table[] = {
function_0,
function_1,
function_2,
function_3,
};
int call_function(int funcnbr, int arg)
{
return sg_func_table[funcnbr](arg);
}
static int function_0(int arg1)
{
...
}
...
The problem that I am encountering is that, on Linux call_function()
works just great, but on Solaris 2.7 (gcc 2.95.1, ld 3.0), it
consistantly core dumps.
When pulled up in the debugger, displaying the address of
function_0 gives something like 0xff35cd60, but when
displaying the address that is stored in sg_func_table[0]
I get 0x35cd60:
(gdb) p function_0
$1 = {int (int)} 0xff35cd60 <function_0>
(gdb) p sg_func_table[0]
$1 = (funcptr *) 0x35cd60
Any ideas why I get this behavior? When statically linking
my program everything works just dandy as well. It looks to
me that, for some reason, the addresses stored in sg_func_table[]
are not PIC addresses.
-scott
--
Scott C. Gray <[EMAIL PROTECTED]> "my keybard is brken"
http://www.voicenet.com/~gray/sqsh.html