From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <9703041943.ZM17911@fabsoft2.zarm.uni-bremen.de> Date: Tue, 4 Mar 1997 19:43:12 +0100 From: Zarmfab Software Development Subject: Re: Xfree and glibc-2.0x Hello Richard, you wrote: >Do things work when you run the program with the environment >variable LD_BIND_NOW=1? i can't tell right now, because i first have to rebuild X, but maybe the following is interesting to you: Trying to recompile perl-5 with glibc-2.01, i encountered a problem with dlopen: Build a shared library containing two functions, one of them referencing the address of the other: ----- shared library libfoo.so, linked with gcc -shared ----------- #include void fun2(void) { ; } void fun1(void) { printf("Address of fun2: %lX",(unsigned long)fun2); } --------------------------------------------------- Then build a simple program, that tries to dlopen() shared libs and reports failures ----- program dynaload, linked with gcc -rdynamic ---------- #include #include int main(int argc ,char *argv[]) { char *errstr; void *handle; if (argc!=2) { puts("wrong args"); exit (1); } handle=dlopen(argv[1],RTLD_LAZY); if (!handle) { errstr=dlerror(); printf("Error loading %s : %s\n",argv[1],errstr); exit (1); } puts("Loading OK"); return 0; } -------------------------------------------------------- then try > dynaload ./libfoo.so If dynaload was linked with -static, this works in any case. ( Loading OK). If dynaload was linked dynamic, it only works with export LD_BIND_NOW=1, if LD_BIND_NOW is not defined, the output is: Error loading ./fcntl.so : ./fcntl.so: undefined symbol: fun2 btw, it looks like the -rdynamic flag to gcc has no affect. -- Martin Cornelius, ZARMFAB software development, University of Bremen phone: 49-421-218-4807 FAX: 49-421-218-3889 email: fabsoft@zarm.uni-bremen.de paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com