Subject: dlopen'ing a plugin that calls functions in the parent...
To: None <netbsd-users@netbsd.org>
From: Jasper Wallace <jasper@pointless.net>
List: netbsd-users
Date: 09/05/2001 21:55:06
-----BEGIN PGP SIGNED MESSAGE-----


Hi,

I'm trying to get the wirless plugin[1] for gkrellm[2] to work under
NetBSD 1.5.2.

After digging around with gdb the call to dlopen() on the plugin fails with
(as reported dy dlerror()):

Error: /usr/home/jasper/.gkrellm/plugins/wireless.so: Undefined PLT symbol
"gkrellm_draw_decal_text" (reloc type = 7, symnum = 31)

gkrellm_draw_decal_text is a function in gkrellm (and gkrellm is NOT
striped).

I guess i need to recompile either the plugin or gkrellm or both with some
magic option(s) that says the plugin can call functions in the 'parent'
process, but i have no idea what the options would be.

I've tried defining the symbols in the plugin using -defsym to the linker,
and getting the symbol addresses from gkrellm with nm.

It can now load the plugin, but when the plugin tries to call a function
in gkrellm it gets a SIGSEGV. - Do i need to add some fixed offset to the
function addresses returned by nm? Am i

I tried -R to the linker with the path to gkrellm, but it comes back with:

/usr/X11R6/bin/gkrellm: could not read symbols: File format not recognized

file says it's:

/usr/X11R6/bin/gkrellm: setgid ELF 32-bit LSB executable, Intel 80386,
version 1, dynamically linked (uses shared libs), not stripped

(it's setgid kmem).

Any one have any clues?

[1] http://gkrellm.luon.net/gkrellmwireless.phtml
[2] http://web.wt.net/~billw/gkrellm/gkrellm.html

- -- 
When Ted's fixing your computer at a quarter past one, eat your
Whopper  with cheese in his face. He functions better when he's
slightly dizzy from hunger.
[see: http://sysday.tripod.com/time.htm]           [0x2ECA0975]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iQEVAwUBO5aRMACB+Qwuygl1AQFx/gf/QFthgCyf8SCbHyAHv1ssIdXl341AeBzI
jEu/XqJmACET3aVoI8HYXc2rR1GOIVMp8RB7Dwgfj6sn/VXW1p2YVz/lpqh4+Gpm
s8QjZvl6+e8DJ+HQgtGVvAbV8Vh61lop9vCggxAHvGpWTdNML2MWCsVNGMey1971
ui7FVeJP1p5ZYoo/9Cc/PWkDKXKGBdnfiMVRnX4dtZRiINQrS6C0OQqlnxRSmJa/
DIs3D9DPUFAP8dGrVAq55oSaVqShvGpU1xFKO9D4wrBT+zwsPPhuNRFzQN6/o6U2
+Q2xim79x48ghXtNGSjsivItEQ0lydBEqTSXtuJQtDNchb6x9dPjkQ==
=dXEg
-----END PGP SIGNATURE-----