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, as follows: LD _
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 in some very old. in the out program, these programs have been created before the ldd-supported compiler is released. if you use ldd in this type of program, the program will try the argc = 0 Running mode, the results are unpredictable.