tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
dlopen fails from static binary
Hi
On netbsd-6, using dlopen in a static binary will return NULL without
setting errno.
It seems wrong. Is dlopen really supposed ot fail when called from
static binary? In that case errno should be set, but to what value?
Or perhaps we could support dlopen from static binary?
Example program:
$ cat test.c
#include <stdio.h>
#include <dlfcn.h>
#include <errno.h>
#include <err.h>
int
main(void)
{
void *dlh;
errno = 0xdeadbeef;
dlh = dlopen("/usr/lib/security/pam_unix.so.3", RTLD_NOW);
if (dlh == NULL)
err(1, "dlopen failed");
printf("success (%p)\n", dlh);
return 0;
}
$ cc -o test test.c && ./test
success (0xbbbea800)
$ cc -static -o test test.c && ./test
test: dlopen failed: Unknown error: 3735928559
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index