All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] elf/resolvfail
@ 2001-05-20  4:22 Matthew Wilcox
  2001-05-20  4:40 ` Ulrich Drepper
  2001-05-21 12:30 ` amodra
  0 siblings, 2 replies; 4+ messages in thread
From: Matthew Wilcox @ 2001-05-20  4:22 UTC (permalink / raw)
  To: parisc-linux

Here's what resolvfail does:

static const char obj[] = "testobj1.so";

int main (void) {
  void *d = dlopen (obj, RTLD_LAZY);
  int n;

  if (d == NULL) {
      printf ("cannot load %s: %s\n", obj, dlerror ());
      return 1;
  }
[...]

and it outputs:

cannot load testobj1.so: /home/willy/cvs/glibc-C/elf/testobj1.so: undefined symbol: foo

nm testobj1.so:
                 U foo

but i would have throught that RTLD_LAZY would mean that it didn't have to
resolve foo immediately, only when it was used.  Can someone explain what's
supposed to happen here?

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] elf/resolvfail
  2001-05-20  4:22 [parisc-linux] elf/resolvfail Matthew Wilcox
@ 2001-05-20  4:40 ` Ulrich Drepper
  2001-05-21 12:30 ` amodra
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2001-05-20  4:40 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: parisc-linux

Matthew Wilcox <matthew@wil.cx> writes:

> but i would have throught that RTLD_LAZY would mean that it didn't have to
> resolve foo immediately, only when it was used.  Can someone explain what's
> supposed to happen here?

Get a box with a working glibc and run

  LD_DEBUG=all /build/dir/elf/ld.so --library-path /build/dir:/build/dir/dlfcn /build/dir/elf/resolvfail


on both.  The output LD_DEBUG provides should help you.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] elf/resolvfail
  2001-05-20  4:22 [parisc-linux] elf/resolvfail Matthew Wilcox
  2001-05-20  4:40 ` Ulrich Drepper
@ 2001-05-21 12:30 ` amodra
  2001-05-21 14:29   ` Matthew Wilcox
  1 sibling, 1 reply; 4+ messages in thread
From: amodra @ 2001-05-21 12:30 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: parisc-linux

On Sun, May 20, 2001 at 05:22:42AM +0100, Matthew Wilcox wrote:
> 
> but i would have throught that RTLD_LAZY would mean that it didn't have to
> resolve foo immediately, only when it was used.  Can someone explain what's
> supposed to happen here?

What type is foo?  Lazy linking only works for .plt entries, ie. functions.

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] elf/resolvfail
  2001-05-21 12:30 ` amodra
@ 2001-05-21 14:29   ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2001-05-21 14:29 UTC (permalink / raw)
  To: amodra; +Cc: Matthew Wilcox, parisc-linux

On Mon, May 21, 2001 at 10:00:03PM +0930, amodra@one.net.au wrote:
> On Sun, May 20, 2001 at 05:22:42AM +0100, Matthew Wilcox wrote:
> > 
> > but i would have throught that RTLD_LAZY would mean that it didn't have to
> > resolve foo immediately, only when it was used.  Can someone explain what's
> > supposed to happen here?
> 
> What type is foo?  Lazy linking only works for .plt entries, ie. functions.

extern int foo (int);

int
obj1func2 (int a)
{
  return foo (a) + 10;
}

18077:  find library=testobj1.so; searching
18077:   search path=/home/willy/cvs/glibc-C:/home/willy/cvs/glibc-C/math:/home/willy/cvs/glibc-C/elf:/home/willy/cvs/glibc-C/dlfcn:/home/willy/cvs/glibc-C/nss:/home/willy/cvs/glibc-C/nis:/home/willy/cvs/glibc-C/rt:/home/willy/cvs/glibc-C/resolv:/home/willy/cvs/glibc-C/crypt:/home/willy/cvs/glibc-C/linuxthreads
        (LD_LIBRARY_PATH)
18077:    trying file=/home/willy/cvs/glibc-C/testobj1.so
18077:    trying file=/home/willy/cvs/glibc-C/math/testobj1.so
18077:    trying file=/home/willy/cvs/glibc-C/elf/testobj1.so
18077:
18077:  file=testobj1.so;  generating link map
18077:    dynamic: 0x40198cd8  base: 0x40188000   size: 0x00010d90
18077:      entry: 0x401887bc  phdr: 0x40188034  phnum:          4
18077:
18077:  checking for version `GLIBC_2.2' in file /home/willy/cvs/glibc-C/libc.so.6 required by file /home/willy/cvs/glibc-C/elf/testobj1.so
18077:  checking for version `GLIBC_2.0' in file /home/willy/cvs/glibc-C/dlfcn/libdl.so.2 required by file /home/willy/cvs/glibc-C/elf/testobj1.so
[...]

18077:  symbol=dlsym;  lookup in file=/home/willy/cvs/glibc-C/elf/resolvfail
18077:  symbol=dlsym;  lookup in file=/home/willy/cvs/glibc-C/dlfcn/libdl.so.2
18077:  binding file /home/willy/cvs/glibc-C/elf/testobj1.so to /home/willy/cvs/glibc-C/dlfcn/libdl.so.2: normal symbol `dlsym' [GLIBC_2.0]
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
elf/resolvfail
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
dlfcn/libdl.so.2
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
linuxthreads/libpthread.so.0
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
libc.so.6
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
elf/ld.so.1
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
elf/testobj1.so
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
dlfcn/libdl.so.2
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
libc.so.6
18077:  symbol=__deregister_frame_info;  lookup in file=/home/willy/cvs/glibc-C/
elf/ld.so.1
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/elf/resolvfail
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/dlfcn/libdl.so.2
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/linuxthreads/libpthr
ead.so.0
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/libc.so.6
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/elf/ld.so.1
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/elf/testobj1.so
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/dlfcn/libdl.so.2
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/libc.so.6
18077:  symbol=foo;  lookup in file=/home/willy/cvs/glibc-C/elf/ld.so.1
18077:
18077:  calling fini: /home/willy/cvs/glibc-C/dlfcn/libdl.so.2

On x86, it never tries to look up `foo' at all.

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-21 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-20  4:22 [parisc-linux] elf/resolvfail Matthew Wilcox
2001-05-20  4:40 ` Ulrich Drepper
2001-05-21 12:30 ` amodra
2001-05-21 14:29   ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.