This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |