Bug in IA64 runtime linker
Ed Connell
Ed.Connell@sas.com
Thu Apr 1 22:36:00 GMT 2004
I have a small test case that I believe illustrates a bug in the
IA64 runtime linker. If my shared library is loaded with RTLD_LAZY,
things don't resolve correctly. The following can be observed on
RHEL 3 for Itanium.
$ as my_lib.s -o my_lib.o
$ ld my_lib.o -o my_lib.so -shared
$ gcc -o driver.now driver.c -ldl -g
$ gcc -o driver.lazy driver.c -ldl -g -DDO_RTLD_LAZY
$ ./driver.now
$ ./driver.lazy
Segmentation fault
$
my_lib.c, which produced my_lib.s (although not with gcc), looks
like this. Making 'cp' one character shorter puts the string in
a different data section and causes this example to work.
***
void lib_fun()
{
char *cp;
char c;
cp = "12345678";
c=*cp;
}
***
driver.c
***
#include <dlfcn.h>
int main()
{
void *handle;
void (*fun)();
#ifdef DO_RTLD_LAZY
handle = dlopen("./my_lib.so", RTLD_LAZY);
#else
handle = dlopen("./my_lib.so", RTLD_NOW);
#endif
fun = dlsym(handle, "lib_fun");
(*fun)();
return 0;
}
***
Cheers
Ed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my_lib.s
Type: application/octet-stream
Size: 943 bytes
Desc: my_lib.s
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040401/33e1f913/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: driver.c
Type: application/octet-stream
Size: 246 bytes
Desc: driver.c
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040401/33e1f913/attachment-0001.obj>
More information about the Libc-alpha
mailing list