Hi,

The simple test program below
segfaults in _dl_thread_kern_go().

I suspect the library, but am not sure
how to proceed.

Add printf()'s to dlfcn.c and rebuild
ld.so?

Hopefully, my test program is wrong
somehow.  :)

Thanks for any suggestions,

m

$ uname -a
OpenBSD oldguy.my.domain 4.6 GENERIC#58 i386
$ cat bad.c
#include <dlfcn.h>
#include <err.h>

int
main(void)
{
        void    *handle;
        char    *fn = "libbat.so";

        handle =  dlopen(fn, RTLD_NOW);
        warnx("handle=%p", handle);
        dlclose(handle);

        return 0;
}
$ gcc -g bad.c && ./a.out
a.out: handle=0x84c9706c
Segmentation fault (core dumped)
$ gdb a.out a.out.core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-openbsd4.6"...
Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libc.so.51.0...done.
Loaded symbols for /usr/lib/libc.so.51.0
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x05481f14 in ?? ()
(gdb) where
#0  0x05481f14 in ?? ()
#1  0x014f536b in _dl_thread_kern_go () from /usr/libexec/ld.so
#2  0x014f4e4b in dlclose () from /usr/libexec/ld.so
#3  0x1c000808 in main () at bad.c:12
(gdb) quit
$ head -12 bad.c | tail -1
        dlclose(handle);
$ grep -A 4 ^_dl_thread_kern_go /usr/src/libexec/ld.so/dlfcn.c
_dl_thread_kern_go(void)
{
       if (_dl_thread_fnc != NULL)
               (*_dl_thread_fnc)(1);
}
$

Reply via email to