chgrp 和链接库
chgrp and linked libraries
根据 /bin/chgrp 上的 ldd linux 命令,执行它唯一必需的库是 libc.so。当用 gdb 调试 chgrp 时,我注意到实际上加载了其他库,例如:
/lib/x86_64-linux-gnu/libnss_compat.so.2
/lib/x86_64-linux-gnu/libnsl.so.1
/lib/x86_64-linux-gnu/libnss_nis.so.2
/lib/x86_64-linux-gnu/libnss_files.so.2
为什么这些库不在 ldd 输出中进行比较?
此外:它们不在 libc.so 的动态部分进行比较,它们是如何定位和加载的? (我用 readelf 检查了 libc.so 的 DYNAMIC 部分,但没有这些库)
各种 libnss
库由 libc
动态加载,通过 dlopen
, when you run the program. Which libraries are loaded is determined by the contents of /etc/nsswitch.conf
. See the Name Service Switch documentation 获取更多详细信息。
根据 /bin/chgrp 上的 ldd linux 命令,执行它唯一必需的库是 libc.so。当用 gdb 调试 chgrp 时,我注意到实际上加载了其他库,例如:
/lib/x86_64-linux-gnu/libnss_compat.so.2
/lib/x86_64-linux-gnu/libnsl.so.1
/lib/x86_64-linux-gnu/libnss_nis.so.2
/lib/x86_64-linux-gnu/libnss_files.so.2
为什么这些库不在 ldd 输出中进行比较?
此外:它们不在 libc.so 的动态部分进行比较,它们是如何定位和加载的? (我用 readelf 检查了 libc.so 的 DYNAMIC 部分,但没有这些库)
各种 libnss
库由 libc
动态加载,通过 dlopen
, when you run the program. Which libraries are loaded is determined by the contents of /etc/nsswitch.conf
. See the Name Service Switch documentation 获取更多详细信息。