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

Bug#477188: libc6: dlopen("libc.so",...) fails



Package: libc6
Version: 2.3.6.ds1-13etch4
Severity: normal

*** Please type your report below this line ***

When I call the program below with "a.out libc.so", the output is:

dlopen: /usr/lib/libc.so: invalid ELF header

This is apparently because /usr/lib/libc.so contains the following:

---------------------------
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-x86-64.so.2 ) )
---------------------------

and while the ordinary linker seems to have no problem with that,
dlopen does not like it.  The behaviour I would expect is that dlopen
opens /lib/libc.so.6, which is apparently what the ordinary linker
does.

The program I used is:
---------------------
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  void *x = dlopen(argv[1],RTLD_NOW);
  if (x == NULL) {
    fprintf(stderr,"dlopen: %s\n",dlerror());
    exit(1);
  }
  printf("%p\n",x);
  return 0;
}
-----------------------

- anton

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable'), (99, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18perfctr-2.6.31
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages libc6 depends on:
ii  tzdata                      2007j-1etch1 Time Zone and Daylight Saving Time

libc6 recommends no packages.

-- no debconf information



Reply to: