Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of Linux's ldd command

Shulou Source: shulou.com Published: 2022-06-01 18:45:54 09月27日 Update

Most people do not understand the knowledge of this article "what is the use of Linux's ldd command", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this article, "what is the use of Linux's ldd command?"

The Linux common command ldd command is used to print a list of shared libraries on which a program or library file depends.

List of shared libraries on which ldd print programs or library files depend

Syntax ldd (option) (parameter) option-version: print instruction version number;-v: detail mode, print all relevant information;-u: print unused direct dependencies;-d: perform relocation and report any missing objects;-r: perform relocation of data objects and functions, and report any missing objects and functions;-- help: display help information. Parameter file: specify an executable program or library.

Other introductions first of all, ldd is not an executable program, but a shell script

Ldd can display the dependency of the executable module by setting a series of environment variables as follows: LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, LD_VERBOSE and so on. When the LD_TRACE_LOADED_OBJECTS environment variable is not empty, any executable program will only display the dependency of the module when it is running, and the program will not actually execute. Or you can test it at the shell terminal, as follows:

Export LD_TRACE_LOADED_OBJECTS=1 then executes any program, such as ls, etc., to see the results of the program.

Ldd shows the working principle of the dependency of the executable module, which is essentially realized through ld-linux.so (the loader of the elf dynamic library). We know that the ld-linux.so module works before the executable module program and gains control, so when the above environment variables are set, ld-linux.so chooses the dependency that displays the executable module.

You can actually execute the ld-linux.so module directly, such as / lib/ld-linux.so.2-- list program (which is equivalent to ldd program)

The above is about the content of this article "what is the use of Linux's ldd command". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Tags: Programs modules commands content information variables objects environments functions principles parameters library files reports articles knowledge articles positioning work help run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL MariaDB Huawei OPPO Reno