logo       

Bug in IA64 runtime linker: msg#00006

lib.glibc.bugs

Subject: Bug in IA64 runtime linker

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

Attachment: my_lib.s
Description: my_lib.s

Attachment: driver.c
Description: driver.c

_______________________________________________
Bug-glibc mailing list
Bug-glibc@xxxxxxx
http://mail.gnu.org/mailman/listinfo/bug-glibc
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise