bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in IA64 runtime linker


From: Ed Connell
Subject: Bug in IA64 runtime linker
Date: Thu, 1 Apr 2004 17:17:24 -0500

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]