Re: [RFA] Introduce solib_loaded observer

Daniel Jacobowitz
2005-01-09T22:37:39Z

On Sun, Jan 09, 2005 at 02:05:15PM +0100, Mark Kettenis wrote:
> > The patch below doesn't only implement the new observer. The reason
> > for that is that when the solib_loaded observer is called, the symbols
> > for the new library haven't been loaded yet. So I've split out the
> > code to read in those symbols out from solib_add() into a seperate
> > function, and made that public.
>
> Could you explain why this is necessary, instead of calling the
> observer after loading symbols? I don't see notification at that point
> as particularly useful. Certainly the first thing the GNU/Linux code
> would want to do would be to load the symbols.
>
> Calling the observer after loading the symbols isn't possible. You
> can set "auto-solib-add" to 0, and then the symbols will never be
> loaded at all. So you'll always have to force loading the symbols
> from within your observer anyway (but you only have to do so for the
> threads library). From a code perspective the point where the
> notification is called is the most logical. And that way it's less
> likely that we see "auto-solib-add" related bugs ;-).

At the same time, I worry that it's going to be confusingly
inconsistent - for instance, I would have expected turning off
auto-solib-add to prevent loading symbols for libpthread! Or at least,
loading of full symbols (all libthread_db on GNU/Linux really needs are
a couple of minsyms).

I don't think "isn't possible" is accurate; there are only two callers
of update_solib_list, and one of them wants to read the symbols. That
could be pushed down into an argument to update_solib_list. Would that
be better?

--
Daniel Jacobowitz