Several commands for viewing the program symbol table

Source: Internet
Author: User

Objdump-t XXX.O

  [email protected]:~/documents/encrypchip$ objdump-t main.omain.o:file format Elf32-littlesymbol TAB le:00000000 l DF *abs* 00000000 main.c00000000 l d. Text 00000000. text00000000 l d. Data 00000000. data0000 0000 L D. BSS 00000000. bss00000000 l D. Mdebug.abi32 00000000. mdebug.abi3200000000 L. Rodata 0000000 0. rodata00000000 L D. Reginfo 00000000. reginfo00000000 L D. Pdr 00000000. pdr00000000 L. Comment 000         00000. comment00000000 l D. Gnu.attributes 00000000. gnu.attributes00000000 g F. Text 000000DC demo100000000 *und* 00000000 GetIdChipSerialNo00000000 *und* 00000000 printf00000000 *und* 00000000 putchar000 000DC g F. Text 0000027c demo200000000 *und* 00000000 _alpu_rand00000000 *und* 00000000 GETTIMEOFDA y00000000 *und* 00000000 alpuc_process00000000 *und* 00000000 puts00000358 g F. Text 0000003c main< /code> 

Readelf-h XXX.O

[email protected]:~/documents/encrypchip$ readelf-h main.o ELF header:magic:7f 4c 46 01 01 01 00 00 00 00 0   0 xx class:elf32 data:2 ' s complement, little endian                       Version:1 (current) Os/abi:unix-system V ABI Version:   0 Type:rel (relocatable file) machine:mips R3000 version:0x1 Entry Point address:0x0 Start of program headers:0 (by tes into file) Start of section headers:1624 (bytes into file) flags:0x1005, Nore Order, CPIC, O32, mips1 size of this header:52 (bytes) Size of program headers:0 (bytes) Numb Er of program headers:0 Size of Sections headers:40 (bytes) Number of section headers:15 Se Ction Header String TablE index:12 

Readelf-s MAIN.O

[email protected]:~/documents/encrypchip$ readelf-s main.o Symbol table '. Symtab ' contains Entries:Num:Va Lue Size Type Bind Vis Ndx Name 0:00000000 0 notype LOCAL DEFAULT UND 1:00000000 0 FILE LOC AL default ABS main.c 2:00000000 0 section local default 1 3:00000000 0 section local default 3 4:0  0000000 0 Section local default 4 5:00000000 0 sections local default 8 6:00000000 0 section Local     Default 9 7:00000000 0 section local default 5 8:00000000 0 section local default 6 9:00000000    0 section local default ten 10:00000000 0 section local default one 11:00000000-FUNC GLOBAL Default 1 demo112:00000000 0 notype Global default UND getidchipserialno13:00000000 0 notype global default UND p rintf14:00000000 0 Notype Global default UND PUTCHAR15:000000DC 636 FUNC Global Default 1 demo216:0000000 0 0 Notype GLOBAL DEfault UND _alpu_rand17:00000000 0 notype Global default UND gettimeofday18:00000000 0 notype Global Default UND alpuc_process19:00000000 0 notype Global default UND puts20:00000358 FUNC GLOBAL default 1 main

NM XXX.O contrasts the difference between the symbol table generated by the g++ compiler and the GCC generation.

[email protected]:~/Documents/encrypchip$ nm main.o #g++ compile     U _Z10_alpu_randv     U _Z13alpuc_processPhS_     U _Z17GetIdChipSerialNoPh00000000 T _Z5demo1v000000dc T _Z5demo2v     U gettimeofday00000358 T main     U printf     U putchar     U puts[email protected]:~/Documents/encrypchip$ mipsel-openwrt-linux-gcc -c main.c mipsel-openwrt-linux-gcc: warning: environment variable ‘STAGING_DIR‘ not defined[email protected]:~/Documents/encrypchip$ nm main.o #gcc compile     U GetIdChipSerialNo     U _alpu_rand     U alpuc_process00000000 T demo1000000dc T demo2         U gettimeofday00000358 T main     U printf     U putchar     U puts

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Several commands for viewing the program symbol table

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.