Learning Manual: ld-Linux usage

Source: Internet
Author: User

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.

  1. Differences between soft and hard links in Linux
  2. Introduction to inode and soft-hardware links from Linux
  3. The Linux operating system no longer supports the anteng processor.
  4. Details about Linux recovery
  5. Describes how to install a wireless NIC Driver in Linux.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.