1. 程式人生 > >Linux 工具套件 —— binutils、readelf

Linux 工具套件 —— binutils、readelf

  • readelf:Linux 下專門針對 ELF 檔案格式的解析器;

0. binutils

  • gnu binutils 一套二進位制工具的集合,主要包含:ld(gnu linker)、as(gnu assembler),此外還包括:
    • addr2line:Converts addresses into filenames and line numbers.
    • ar:A utility for creating, modifying and extracting from archives.
    • c++filt:Filter to demangle encoded C++ symbols.
    • dlltool:A new, faster, ELF only linker, still in beta test.
    • gold:A new, faster, ELF only linker, still in beta test.
    • gprof:Displays profiling information.
    • nlmconv:Converts object code into an NLM.
    • nm:Lists symbols from object files.
    • objcopy:Copies and translates object files.
    • objdump:Displays information from object files.
    • ranlib:Generates an index to the contents of an archive.
    • readelf:Displays information from any ELF format object file.
    • size:Lists printable strings from files.
    • strip:Discards symbols.
    • windmc:A Windows compatible(相容的) message compiler.
    • windres:A compiler for Windows resource files.

1. objdump

  • objdump:顧名思義,檢視顯示 obj(目標檔案)的內部結構;

    $ gcc -c hello.c
        # -c 表示只編譯不連結;
    $ objdump -h hello.o