I wrote a shared library named "libmyssl.so", I use some openssl function in my code, the make file looks like follows:
g++ -v -shared -lz -lssl -lcrypto -Wl,-soname,libmyssl.so.1,-o libmyssl.so.1.0 myssl.o
After that, I use ldd command to look if it depends on libssl.so:
ldd libmyssl.so.1.0
The result as follows:
linux-vdso.so.1 => (0x00007fff743fe000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0bc963b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0bc9276000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0bc8f6f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0bc9ea0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0bc8d59000)
It seems it didn't depend on libssl.so, am I right?
However, I use readelf -s command to see the symbols as follows:
readelf -s libmyssl.so.1.0
The reasult as follow:
......
259: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND SSL_new
260: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND SSL_get_shutdown
261: 0000000000000000 0 FUNC GLOBAL DEFAULT UND close@GLIBC_2.2.5 (4)
262: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND d2i_X509
263: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND X509_get_pubkey
264: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND SSL_set_info_callback
265: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gmtime_r@GLIBC_2.2.5 (4)
......
It seems that the X509_get_putkey is not relocated. So it should depend on libssl.so. Maybe I didn't understand it well.
Hope someone can explain more about that, thanks very much!