Yong Sun wrote: > Hi, Rod, > > Thanks, if I dlopen with RTLD_NOW, or build the libbase.so with > -Bdirect, this problem would not happen.
I'd be careful of -Bdirect and C++. -Bdirect can result in different callers binding to different definitions of the same named symbol. This is verify often useful, and what you want to achieve. But C++ is littered with implementation details that expect interposition to occur with some of their multiply defined symbols. -Bdirect can break this expectation. RTLD_NOW results in ld.so.1 performing all relocations on the loaded objects - thus, the interdependencies of the function calls that have been bound are added to the mix to determine the topological sort of the .init sections. I suspect this sort has resulted in a different firing order than the sort that is determined when only the data symbol relocation bindings have been processed. You might still be skating on thin ice ... cyclic dependencies between .init code should be avoided. -- Rod.