Subject: Re: dlopen'ing a plugin that calls functions in the parent...
To: Oleg Polianski <Oleg.Polianski@clear.co.nz>
From: Jasper Wallace <jasper@pointless.net>
List: netbsd-users
Date: 09/10/2001 12:59:09
-----BEGIN PGP SIGNED MESSAGE-----

On 10 Sep 2001, Oleg Polianski wrote:

> 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.

does

nm /path/to/libXft.whatever | grep XftFontOpenXlfd

show anything?

are you using -Wl,--rpath /path/to/libXft/ when you link libgdkxft.so?

> > 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>
>
>

- -- 
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

iQEVAwUBO5yrFACB+Qwuygl1AQE09gf/SJg1ul2FuUB7ssXtMmI28YyLfjsKhHyc
cPdpGWNDp7jqN51kMfITsliV0c4jdWHhjYnU0ufa3S6hzp1K7R5i1p2/IC2ihnqA
bM1bref42m9gkerqsBW9RBmBNWwcNxRlEAYxQLiyuH9FeJtNUDkaaKinkggEHviH
SileulXln4aC6lNLMfdkagmpQ7BREda0xhEfOuRfF3Lq9m0Vrvm9I2VpolJJ9muJ
NiI/mrTAexQ11hX3tcMAtctoDgrRdSl7hnFwKLFgmh8y00oP4QKBJXvcswBckkiT
1zx7Arr3HQaqGA8RDn1Q0xcA7PPmG7d3kijBRTvAX7ou9jr1pFj78w==
=8Crh
-----END PGP SIGNATURE-----