A command that knows the file invocation status of commands in LINUX
Source: Internet
Author: User
The command that knows the file calling status of commands in LINUX-general Linux technology-Linux programming and kernel information. The following is a detailed description. Ldd/full/path/conmmand
1. ldd is not an executable program, but a shell script.
2. ldd can display the dependency of the executable module. The principle is to set a series of environment variables, such as LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, and LD_VERBOSE. When the LD_TRACE_LOADED_OBJECTS environment variable is not empty, when any executable program is running, it only displays the dependency of the module, and the program is not actually executed. Or you can test it on the shell terminal as follows:
(1) export LD_TRACE_LOADED_OBJECTS = 1
(2) execute any program, such as ls, and check the running result of the program.
3. ldd shows the dependency working principle of the executable module. Its essence is realized by ld-linux.so (loader of elf dynamic library. We know that the ld-linux.so module will work prior to the executable module program and gain control, so when those environment variables above are set, the ld-linux.so selects the dependency that shows the executable module.
4. In fact, you can directly execute the ld-linux.so module, such as:/lib/ld-linux.so.2 -- list program (which is equivalent to ldd program) ldd command usage method (from ldd -- help) name ldd-print the dependency of the Shared Library
Outline ldd [Option]... file...
Describes the shared libraries required for each program or shared library specified by ldd output on the command line.
Option
-- Version
Print the version number of ldd.
-V -- verbose
Print all information, such as the version information of the symbol.
-D -- data-relocs
Execute the symbol re-deployment and report the missing target object (only applicable to the ELF format)
-R -- function-relocs
Redeploy the target object and function and report the missing target object and function (applicable only to the ELF format)
-- Help usage information
Note:
The standard version of ldd is provided together with glibc2. Libc5 and earlier versions are available in some systems. Long options are not supported in libc5. On the other hand, glibc2 does not support the-V option, but only provides the equivalent -- version option.
If the given library name in the command line contains '/', the libc5 version of this program uses it as the Library name; otherwise, it searches for the library in the standard location. Run a shared library under the current directory with the prefix "./".
Error:
Ldd cannot work on a. out shared library.
Ldd cannot work on some very old a. out programs that have been created before the release of ldd compilers. If you use ldd in this type of program, the program will try the running mode of argc = 0, and the result is unpredictable.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.