Re: how serious are these compiler warnings?



On Thu, 06 Apr 2006 09:33:56 PDT, Rick Jones said:

> So, by default, AIX is rather like Windows or OpenVMS in that the 
> library an executable loads cannot reach-out and call a routines from 
> the executable itself :(

Not by name.  However, calling through a function pointer will work.

> > The run-time symptom is a segfault in glink.* (usually, trying to load a
> > wild address pointer for the un-relocated function....)
> > 
> > To fix, you need to do one of:
> > 
> > a) Add '-brtl' flags at appropriate places (you may need to rebuild all the
> > libraries involved).  The rtl is "run-time-linker" and basically does relocation
> > and call resolution on libfoo.so after it gets loaded.
> 
> Am I correct in assuming that also means main?

I've never encountered that case, where libfoo.so referenced a function quux()
and the body was supplied by the main program.  Usually, it's done in some
way where libfoo calls through a function pointer, and the address of quux() is
passed as a parameter when registering the callback....

> I think I need to take option a - in my case libfoo is being dynamically 
> loaded vi g_module_open.
> 
> I would have thought that libtool would have included that option for 
> AIX when it was told to -export-dynamic?

Check what version of libtool - many older ones (and possibly new ones) will
get weirded out by the bizarre semantics of the AIX linker.....

Also, read the documentation on -brtl as well - there's some gotchas. One biggie
is that just adding -brtl to the final link of the main program doesn't actually
do much good - you need to rebuild the glib and gtk shared library objects
with -brtl as well, because if the .so doesn't have some stuff tagged in the
header, the main program's runtime linking won't look at it.  And then once you
do that, trying to link a main program to it and omitting -brtl will cause
odd failures....

You may find that recoding things to pass a function pointer is the more sane
way to work around it. ;)

Attachment: pgpeH4zqq76D0.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]