linux - Change in gnu ld linker behavior -


when went using gnu ld version 2.20 2.21 , began seeing following change in behavior. not sure if broken behavior in 2.20 fixed in 2.21 or if else going on.

libfoo.so : provides symbols foo()  libfoobar.so : provides symbol bar() , specifies libfoo.so in dt_needed slot main.cpp : uses symbols foo() bar() 

previously, build main.cpp doing :

g++ main.cpp -lfoobar 

the internal dependency of foobar.so on foo.so ensure foo() bar() found

now, above not work , have explicitly link foo :

g++ main.cpp -lfoobar -lfoo 

so question : right behavior - if .so has dependencies, considered when searching symbols used directly in executable or these dependencies available in private namespace .so only?

thanks.

so question : right behavior

the new behavior right one.

if .so has dependencies, considered when searching symbols used directly in executable

no. whatever dependencies libfoobar.so has private implementation detail, can change tomorrow. should not count on it. if use symbols libfoo.so, should specify -lfoo on command line.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -