Linuxstrings command-ELF File Format and "link and load"

Source: Internet
Author: User

A string command

The string command is mainly used to view the ASCII string in a non-text file. Of course, you can also view the corresponding string of a text file. The command is used as follows:

[22: 41huangyk @ leetcode] $> strings-a numDistinct | grep lib
/Lib64/ld-linux-x86-64.so.2
Libstdc ++. so.6
Libm. so.6
Libgcc_s.so.1
Libc. so.6
_ Libc_start_main
/Usr/local/gcc4.8.3/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/include
Libio. h
Cstdlib
Stdlib. h
_ Libc_csu_fini
_ Libc_start_main @ GLIBC_2.2.5
_ Libc_csu_init

NumDistinct is an executable file. By default, the initialization section and the loadable bytes are printed. After the-a parameter is added, all segments are printed.

Ii. Loading ELF files and links

In some cases, there may be multiple ELF file versions compiled by GCC on our system at the same time. In this case, if you run the program, it is easy to see the problem "/usr/lib64/libstdc ++. so.6: version 'glibcxx _ 3.4.14 'not found solution ". For more information, see the corresponding blog. Here we will discuss a question:

In an ELF file format, How do I know which connector is needed and which version of glibc is used?

Answer: The ELF file contains a lot of information, including the connector and glibc version required to execute this file. You can use the string command to view details. The result is as follows:

[22: 52huangyk @ leetcode] $> strings numDistinct | grep GLIB
GLIBC_2.2.5
GLIBCXX_3.4.5
GLIBCXX_3.4.14
GLIBCXX_3.4

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.