On Wed, Apr 23, 2025 at 09:09:56PM +0300, Andriy Gapon wrote: > On 19/04/2025 13:29, Konstantin Belousov wrote: > > On Sat, Apr 19, 2025 at 01:25:28PM +0300, Andriy Gapon wrote: > > > On 19/04/2025 12:39, Andriy Gapon wrote: > > > > From a quick look at the code, should we try to resolve the symbol in > > > > refobj itself when it's marked with deepbind? > > > Oh, and it looks like objects loaded under the "deepbind" object (e.g., > > > needed objects) may not be aware that they are in the deepbind sub-tree? > > > > But should they? > > That's a right question. > > I have been reading about RTLD_DEEPBIND and Solaris flags like RTLD_GROUP, > etc at the same time. I guess that's why some things got "fused" in my > mind. So, I started believing that the concept of shared object dependency > groups also applies to RTLD_DEEPBIND. > > But that's not documented to be so, at least, in the documentation that I > could find. There are some in-depth documentation on Solaris run-time > linker and its handling of various options. But for Linux RTLD_DEEPBIND I > could find only manual page references and they only say that deep-binding > applies to to the object being dlopen-ed. > > I am not sure if that's how the option actually works on Linux. > I allow for possibility that the manual pages omit (or, at least, do not > spell out) some details for brevity. > > In any case, I believe that the proposed patch is correct. > But I think that it would not help in my case. > I have: mdb -[dlopen]-> dtrace.so -[needs]-> libdtrace.so. > And it's a symbol in libdtrace.so that gets resolved to mdb instead of > libdtrace.so itself. > The patch would affect how symbols in dtrace.so are resolved if I understand > correctly. Well, it would also affect libdtrace.so, starting the resolution from libdtrace, then falling back to the global list.
It might be that RTLD_GROUP is something you need, assuming that for dependencies, resolution should go into the first dso in group.