Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Zarmfab Software Development <fabsoft@fabsoft2.zarm.uni-bremen.de>
Subject: Re: Xfree and glibc-2.0x
Date: Tue, 4 Mar 1997 19:43:12 +0100	[thread overview]
Message-ID: <f7c291e435531e3e145732e737b58971.axp-list@archive.invalid> (raw)

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 <stdio.h>

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 <stdio.h>
#include <dlfcn.h>

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

             reply	other threads:[~1997-03-04 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-04 18:43 Zarmfab Software Development [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-03-04 11:54 Xfree and glibc-2.0x Zarmfab Software Development
1997-03-04 17:22 ` Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox