Re: dlsym() on implicit loaded symbols
Am 16.07.2006 um 14:33 schrieb Simon 'corecode' Schubert: Roland Dittel wrote: We have a issue with dlsym() on symbols imported by a library that was loaded with dlopen(). Our code loads the libssl with dlopen() and then do a dlsym() on several symbols. This works for all symbols exported by libssl itself but fails for symbols exported by libcrypto. [..] func = dlsym(handle, "CRYPTO_set_id_callback"); you have to use RTLD_DEFAULT instead of handle, but I agree, this is not in conformance with SUSv3: That's it. Thank you very much. Roland The dlsym() function shall search for the named symbol in all objects loaded automatically as a result of loading the object referenced by handle (see dlopen()). Load ordering is used in dlsym() operations upon the global symbol object. The symbol resolution algorithm used shall be dependency order as described in dlopen(). The RTLD_DEFAULT and RTLD_NEXT flags are reserved for future use. Note "in all objects loaded automatically". Good catch! cheers simon -- Serve - BSD +++ RENT this banner advert +++ASCII Ribbon /"\ Work - Mac +++ space for low €€€ NOW!1 +++ Campaign \ / Party Enjoy Relax | http://dragonflybsd.org Against HTML \ Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: dlsym() on implicit loaded symbols
Simon 'corecode' Schubert wrote: Roland Dittel wrote: Hi all, We have a issue with dlsym() on symbols imported by a library that was loaded with dlopen(). Our code loads the libssl with dlopen() and then do a dlsym() on several symbols. This works for all symbols exported by libssl itself but fails for symbols exported by libcrypto. Libssl is dynamically linked to libcrypto and should be loaded for libssl. I did a truss and the FreeBSD loader loads libcrypto but does not read anything from the file pointer. could you post a sample code fragment which illustrates the problem you are seeing? Sure, attached is a simple example that tries to load the symbol CRYPTO_set_id_callback from a libssl handle. The symbol is located in libcrypto and NOT in libssl. Because libssl is dynamically linked to libcrypto I would expect the loader is able to find the symbol, but that's not the case on freebsd. cheers simon ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
dlsym() on implicit loaded symbols
Hi all, We have a issue with dlsym() on symbols imported by a library that was loaded with dlopen(). Our code loads the libssl with dlopen() and then do a dlsym() on several symbols. This works for all symbols exported by libssl itself but fails for symbols exported by libcrypto. Libssl is dynamically linked to libcrypto and should be loaded for libssl. I did a truss and the FreeBSD loader loads libcrypto but does not read anything from the file pointer. This is the truss output: access("/prod/lib/fbsd-i386/libssl.so",0) = 0 (0x0) open("/prod/lib/fbsd-i386/libssl.so",0x0,027757760020) = 3 (0x3) fstat(3,0xbfbfe010) = 0 (0x0) fstatfs(0x3,0xbfbfde30) = 0 (0x0) read(3,"ELF ",4096) = 4096 (0x1000) mmap(0x0,229376,(0x5)PROT_READ|PROT_EXEC,(0x20002)MAP_NOCORE|MAP_PRIVATE ,3,0x0) = 674971648 (0x283b4000) mprotect(0x283e7000,4096,(0x7)PROT_READ|PROT_WRITE|PROT_EXEC) = 0 (0x0) mprotect(0x283e7000,4096,(0x5)PROT_READ|PROT_EXEC) = 0 (0x0) mmap(0x283e8000,16384,(0x3)PROT_READ|PROT_WRITE,(0x12)MAP_FIXED|MAP_PRIV ATE,3,0x33000) = 675184640 (0x283e8000) close(3) = 0 (0x0) access("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0) = 0 (0x0) open("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0x0,05005664564) = 3 (0x3) fstat(3,0xbfbfdfe0) = 0 (0x0) close(3) = 0 (0x0) mmap(0x0,5528,(0x3)PROT_READ|PROT_WRITE,(0x1000)MAP_ANON,-1,0x0) = 675201024 (0x283ec000) munmap(0x283ec000,5528) = 0 (0x0) On solaris, linux and irix the same code works fine and the libcrypto symbols are implicit loaded and usable. Does anyone know why FreeBSD behaves differently that other Unixes? Thanks, Roland ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"