[root@f96be0f450a4 tmp]# ldd /usr/bin/python2.7
linux-vdso.so.1 => (0x00007ffc63f78000)
libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fb2b7efc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb2b7ce0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb2b7adc000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fb2b78d9000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb2b75d7000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb2b7209000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb2b82c8000)
[root@f96be0f450a4 tmp]# readelf /usr/lib64/libpython2.7.so.1.0 -a |grep sock
[root@f96be0f450a4 tmp]# readelf /usr/bin/python2.7 -a |grep socket
[root@f96be0f450a4 tmp]# readelf /usr/lib64/libpython2.7.so.1.0 -a |grep open
00000037f7f8 002e00000007 R_X86_64_JUMP_SLO 0000000000000000 opendir@GLIBC_2.2.5 + 0
000000380140 007300000007 R_X86_64_JUMP_SLO 0000000000000000 fopen64@GLIBC_2.2.5 + 0
000000380278 007d00000007 R_X86_64_JUMP_SLO 0000000000000000 openpty@GLIBC_2.2.5 + 0
0000003803e8 008400000007 R_X86_64_JUMP_SLO 0000000000000000 dlopen@GLIBC_2.2.5 + 0
000000380810 00a400000007 R_X86_64_JUMP_SLO 0000000000000000 fdopen@GLIBC_2.2.5 + 0
000000380900 00ad00000007 R_X86_64_JUMP_SLO 0000000000000000 open64@GLIBC_2.2.5 + 0
000000380a80 00bc00000007 R_X86_64_JUMP_SLO 0000000000000000 popen@GLIBC_2.2.5 + 0
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND opendir@GLIBC_2.2.5 (3)
115: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fopen64@GLIBC_2.2.5 (3)
125: 0000000000000000 0 FUNC GLOBAL DEFAULT UND openpty@GLIBC_2.2.5 (9)
132: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlopen@GLIBC_2.2.5 (10)
164: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fdopen@GLIBC_2.2.5 (3)
173: 0000000000000000 0 FUNC GLOBAL DEFAULT UND open64@GLIBC_2.2.5 (4)
188: 0000000000000000 0 FUNC GLOBAL DEFAULT UND popen@GLIBC_2.2.5 (3)
[root@f96be0f450a4 tmp]# readelf /usr/bin/ssh -a |grep socket
0000002b8548 002b00000007 R_X86_64_JUMP_SLO 0000000000000000 socket@GLIBC_2.2.5 + 0
0000002b8918 00b400000007 R_X86_64_JUMP_SLO 0000000000000000 socketpair@GLIBC_2.2.5 + 0
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND socket@GLIBC_2.2.5 (5)
180: 0000000000000000 0 FUNC GLOBAL DEFAULT UND socketpair@GLIBC_2.2.5 (5)
1
pmispig OP 通过 strace 知道了,python 动态加载了 so
``` readelf -a /usr/lib64/python2.7/lib-dynload/_socketmodule.so |grep socket 00000020f1f0 004500000007 R_X86_64_JUMP_SLO 0000000000000000 socketpair@GLIBC_2.2.5 + 0 00000020f3b8 008200000007 R_X86_64_JUMP_SLO 0000000000000000 socket@GLIBC_2.2.5 + 0 69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND socketpair@GLIBC_2.2.5 (2) 130: 0000000000000000 0 FUNC GLOBAL DEFAULT UND socket@GLIBC_2.2.5 (2) 137: 0000000000008d10 5379 FUNC GLOBAL DEFAULT 11 init_socket ``` |