Subject: Re: dlopen'ing a plugin that calls functions in the parent...
To: None <thorpej@wasabisystems.com>
From: Oleg Polianski <Oleg.Polianski@clear.co.nz>
List: netbsd-users
Date: 09/10/2001 19:27:01
Jason R Thorpe <thorpej@wasabisystems.com> writes:
Hi there
It could be somewhat very similar but looks slightly different (another
symnum) and I still don't understand what exactly could be wrong. I'm trying
to preload shared object which simply overrides some entry points in
`libgdk.so' and does rendering properly (support for anti-aliasing); it
tries to access some code from `libXft.so' (which is part of locally built
XFree86 4.1.0) as well. But when I start the program (any gtk-based program
which uses font widgets), I get the following:
simoom p5 /opt/tmp/gdkxft-1.0 10211% LD_PRELOAD=/usr/local/lib/libgdkxft.so gfontsel
/usr/local/lib/libgdkxft.so: Undefined PLT symbol "XftFontOpenXlfd" (reloc type = 7, symnum = 67)
I recompiled both, `libXft' and `gdkxft' with `--export-dynamic' but still
have no success. I went through the code, it doesn't look strange - only
dlopen/dlsym/indirect call sequences, i.e. it doesn't have any callbacks and
so on. Still wondering, what could be wrong, any ideas are greatly
appreciated.
> On Wed, Sep 05, 2001 at 09:55:06PM +0100, Jasper Wallace wrote:
>
> > 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).
>
> gkrellm needs to be linked with the -E (--export-dyanmic) option. That
> should fix your problem.
>
> Any program which opens a shared object that needs to call back into
> the parent needs this option. I guess maybe it's the default on Linux,
> or something, because lots of programs fail to include it in their
> Makefiles.
>
> --
> -- Jason R. Thorpe <thorpej@wasabisystems.com>
--
-- Oleg Polianski <Oleg.Polianski@clear.co.nz>