Christos Zoulas <christos%zoulas.com@localhost> wrote:
> | That means that dlopen() would ignore libpthread.so and carry on,
> | instead of considering it fatal and return an error? That would solve a
> | lot of problems, IMO.
>
> I think so.
I gave it a try: in _rtld_load_needed_objects() if I discover an object
has NOLOAD, I remove it from the list so that it is silently not loaded
But that breaks in the following scenatio:
- program foo is not linked with -lpthread, it does not use thread
- libbar is linked with libbuz, it does not use threads
- libbuz is linked with -lpthread but neither foo nor libbar use
trhead-related stuff in libbuz.
dlopen("libbar",RTLD_NOW) still fails with my change, because in
_rtld_relocate_objects(), we break here when resolving now missing
libpthread references in libbuz:
dbg(("doing lazy PLT binding"));
if (_rtld_relocate_plt_lazy(obj) < 0)
ok = 0;
if (obj->z_now || bind_now) {
dbg(("doing immediate PLT binding"));
if (_rtld_relocate_plt_objects(obj) < 0)
ok = 0;
}
--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost