Home >Backend Development >C++ >How Can I List and Identify the Origin of Symbols in a .so File?

How Can I List and Identify the Origin of Symbols in a .so File?

DDD
DDDOriginal
2024-12-22 22:21:10550browse

How Can I List and Identify the Origin of Symbols in a .so File?

How to Identify the Symbols Within a .so File

Question: How can I enumerate the symbols exported from a shared object file (.so) and determine their origin, specifically discerning if they originate from a static library?

Answer:

The standard utility for symbol listing is nm. Utilize it as follows:

nm -gD yourLib.so

For C libraries, incorporate the "-C" option to demangle symbols, enhancing readability.

nm -gDC yourLib.so

In cases where the .so file is in elf format, two options are available:

Using objdump:

objdump -TC libz.so

Using readelf:

readelf -Ws libz.so

The above is the detailed content of How Can I List and Identify the Origin of Symbols in a .so File?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn