使用ldd指令 可以看到程序连接的动态库 如下 [root@R020 ~]# ldd /bin/ls linux-gate.so.1 => (0x0016b000) librt.so.1 => /lib/librt.so.1 (0x48319000) libacl.so.1 => /lib/libacl.so.1 (0x41b1f000) libselinux.so.1 => /lib/libselinux.so.1 (0x48324000) libc.so.6 => /lib/libc.so.6 (0x41991000) libpthread.so.0 => /lib/libpthread.so.0 (0x4cb7d000) /lib/ld-linux.so.2 (0x4196f000) libattr.so.1 => /lib/libattr.so.1 (0x41b18000) libdl.so.2 => /lib/libdl.so.2 (0x4c908000) libsepol.so.1 => /lib/libsepol.so.1 (0x41b38000) 直接在shell下运行libc.so.6可以得到c library版本 [root@R020 ~]# /lib/libc.so.6 GNU C Library stable release version 2.5, by Roland McGrath et al. Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.1.1 20061011 (Red Hat 4.1.1-30). Compiled on a Linux 2.6.9 system on 2007-03-14. Available extensions: The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson GNU libio by Per Bothner NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio Thread-local storage support included. For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>.
[root@localhost programTest]# strace /lib/i686/nosegneg/libc.so.6 execve("/lib/i686/nosegneg/libc.so.6", ["/lib/i686/nosegneg/libc.so.6"], [/* 30 vars */]) = 0 brk(0) = 0x4b46d000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7 fee000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7 fed000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb7fed6c0, limit:1048575, seg_ 32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, usea ble:1}) = 0 mprotect(0x49a4a000, 8192, PROT_READ) = 0 mprotect(0x48f59000, 4096, PROT_READ) = 0 write(1, "GNU C Library stable release ver"..., 819GNU C Library stable release version 2.5, by Roland McGrath et al. Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.1.1 20060928 (Red Hat 4.1.1-28). Compiled on a Linux 2.6.9 system on 2006-10-08. Available extensions: The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson GNU libio by Per Bothner NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio Thread-local storage support included. For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>. ) = 819 exit_group(0) = ? Process 10329 detached [root@localhost programTest]# strace /lib/i686/nosegneg/libc.so.6 execve("/lib/i686/nosegneg/libc.so.6", ["/lib/i686/nosegneg/libc.so.6"], [/* 30 vars */]) = 0 brk(0) = 0x4a700000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f50000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f4f000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f4f6c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 mprotect(0x49a4a000, 8192, PROT_READ) = 0 mprotect(0x48f59000, 4096, PROT_READ) = 0 write(1, "GNU C Library stable release ver"..., 819GNU C Library stable release version 2.5, by Roland McGrath et al. Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.1.1 20060928 (Red Hat 4.1.1-28). Compiled on a Linux 2.6.9 system on 2006-10-08. Available extensions: The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson GNU libio by Per Bothner NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio Thread-local storage support included. For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>. ) = 819 exit_group(0) = ? Process 10334 detached