After studying Linux for a long time, I encountered many problems and solved some problems. So I would like to share with you the usage of ld-Linux, after reading this article, you will certainly have a lot to learn about ld-Linux usage. I hope this article will teach you more things. Ld-Linux has two usage methods: indirect call and direct call.
During indirect calls, the connector embeds the ld-Linux execution path into an executable file, such as an elf file, which is placed in the. interp segment.
During Direct calling, enter/lib/ld-Linux-so. * [Options] [executable programs] [program parameters] in the command line.
Ld-Linux searches for the shared libraries required by executable programs in the following order:
1. (Only for elf files) if the executable program contains the DT_RPATH or DT_RUNPATH segment, use the search directory specified in the two segments.
2. Use the search directory specified by the Environment Variable LD_LIBRARY_PATH
3. Use the search directory in/etc/ld. so. cache, but if the executable program adds the-z nodeflib option during connection, it is not used.
4. Use the default library directory/lib/usr/lib. If-z nodeflib is added, it is not used.
When compiling an executable program, you can install the following method to specify the directory of the shared library.
Gcc-Xlinker-rpath = DIR-o exe. c
After compilation, run readelf-d exe and you can see the following section:
0x0000000f (RPATH) Library rpath: [DIR]
The above is the ld-Linux usage.
- Differences between soft and hard links in Linux
- Introduction to inode and soft-hardware links from Linux
- The Linux operating system no longer supports the anteng processor.
- Details about Linux recovery
- Describes how to install a wireless NIC Driver in Linux.