Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the readelf command in linux to display information about files in elf format

Shulou Source: shulou.com Published: 2022-06-02 13:49:09 11月06日 Update

Editor to share with you the use of linux readelf command to display elf format file information, I believe that most people do not know much, so share this article for you to learn, I hope you will learn a lot after reading this article, let's go to learn the method!

The readelf command is used to display information about one or more target files in elf format, and you can control what information is displayed through its options. The elf-file (s) here represents the files that are being checked. It can support 32-bit and 64-bit elf files, as well as documents containing elf files (here, it generally refers to the "static library" files such as lib*.a generated after some elf files are packaged using the ar command).

This program is similar to the function provided by objdump, but it displays more specific information, and it does not rely on the BFD library (the BFD library is a GNU project, its goal is to deal with different object files through a unified interface), so even if there is any bug in the BFD library, it will not affect the readelf program.

Also note that when running readelf, except for-v and-H, one of the other options must be specified.

Syntax format: readelf [parameter] [file name]

Common options:

Reference example

Read elf file header information in the form of an executable file:

[root@linuxcool] # readelf-h main

Read the elf file header information in the form of the target file:

[root@linuxcool] # readelf-h myfile.o

Read the elf header information in the form of a static library file:

[root@linuxcool] # readelf-h libmy.a

Read elf file header information in the form of a dynamic library file:

[root@linuxcool] # readelf-h libmy.so

View executable elf file program header table information:

[root@linuxcool ~] # readelf-l main above is all the contents of using the readelf command in linux to display the information of the file in elf format. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: File information format command form object program learning content library file static support different not much function dynamic parameter can be passed multiple most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia OPPO Reno Docker MariaDB