[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using libtldl for dynamic loading
From: |
Roger Leigh |
Subject: |
Using libtldl for dynamic loading |
Date: |
01 Oct 2002 16:16:59 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
I would like to be able to use dynamically-loaded modules/plug-ins in
a project.
I am reading the autobook, which gives details (and examples) for
using libdl and libltdl. I can get the libdl example to work, where
dlopen()/dlsym() work just fine. However, libltdl does not. It dumps
core when I try to use a function pointer obtained with lt_dlsym().
Possibly the module isn't being mapped in properly. I can't get it to
work with plain gcc-generated .so modules, or libtool-generated .so's
with a .la file too. strace does show it being opened though:
open(".libs/ltdl-module.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\7\0\000"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=6058, ...}) = 0
getcwd("/tmp/examples/ltdl-1.0", 128) = 23
old_mmap(NULL, 6984, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40014000
mprotect(0x40015000, 2888, PROT_NONE) = 0
old_mmap(0x40015000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) =
0x40015000
close(3) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=73359, ...}) = 0
old_mmap(NULL, 73359, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4014d000
close(3) = 0
open("/lib/libm.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2007\0"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0644, st_size=130088, ...}) = 0
old_mmap(NULL, 132708, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4015f000
mprotect(0x4017f000, 1636, PROT_NONE) = 0
old_mmap(0x4017f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x1f000) = 0x4017f000
close(3) = 0
munmap(0x4014d000, 73359) = 0
munmap(0x40014000, 6984) = 0
munmap(0x4015f000, 132708) = 0
--- SIGSEGV (Segmentation fault) ---
gdb shows these mappings, which don't seem to include ltdl-module or libm:
(gdb) info proc mappings
process 16697
cmdline = '/tmp/examples/ltdl-1.0/ltdl-loader'
cwd = '/tmp/examples/ltdl-1.0'
exe = '/tmp/examples/ltdl-1.0/ltdl-loader'
Mapped address spaces:
Start Addr End Addr Size Offset objfile
0x8048000 0x8049000 0x1000 0
/tmp/examples/ltdl-1.0/ltdl-loader
0x8049000 0x804a000 0x1000 0
/tmp/examples/ltdl-1.0/ltdl-loader
0x804a000 0x804b000 0x1000 0
0x40000000 0x40013000 0x13000 0 /lib/ld-2.2.5.so
0x40013000 0x40014000 0x1000 0x13000 /lib/ld-2.2.5.so
0x40026000 0x4002b000 0x5000 0
/usr/lib/libltdl.so.3.1.0
0x4002b000 0x4002c000 0x1000 0x4000
/usr/lib/libltdl.so.3.1.0
0x4002c000 0x4002e000 0x2000 0 /lib/libdl-2.2.5.so
0x4002e000 0x4002f000 0x1000 0x1000 /lib/libdl-2.2.5.so
0x4002f000 0x40030000 0x1000 0
0x40030000 0x40143000 0x113000 0 /lib/libc-2.2.5.so
0x40143000 0x40149000 0x6000 0x113000 /lib/libc-2.2.5.so
0x40149000 0x4014d000 0x4000 0
0xbfffe000 0xc0000000 0x2000 0xfffff000
I get this with both the copies I typed in, and the pristine examples
(no typos!). Is there anything I should be doing in addition to the
instructions in the autobook, or is libltdl broken? I'm using Debian
libtool 1.4.2a from Debian stable and unstable, with gcc 2.95.4 and
3.2.0.
Thanks,
Roger
BTW, I'm not yet subscribed to the libtool list, so please Cc me in
any replies. Thanks.
--
Roger Leigh
"Liberty and Livelihood" - Support the Countryside Alliance
Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848 available on public keyservers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Using libtldl for dynamic loading,
Roger Leigh <=