Objdump-t XXX.O
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ objdump-t main.o main.o:file format elf32-little SYMBOL TABLE: 00000000 L DF *abs* 00000000 Main.c 00000000 L-Text 00000000. Text 00000000 L. Data 00000000. Data 0000 0000 L. BSS 00000000. BSS 00000000 L. MDEBUG.ABI32 00000000. Mdebug.abi32 00000000 L. rodata 00000 Rodata 00000000 L. Reginfo 00000000. Reginfo 00000000 L. PDR 00000000 PDR. 00000000 L. Comment 00000000. Comment 00000000 L. Gnu.attributes 00000000. Gnu.attributes 00000000 G F. Text 000000DC demo1 00 000000 *und* 00000000 Getidchipserialno 00000000 *und* 00000000 Printf 00000000 *und* 00000000 Putchar 000000DC g F. Text 0000027c Demo2 00000000 *und* 00000000 _alpu_rand 00000000 *und* 0000000 0 Gettimeofday 00000000 *und* 00000000 Alpuc_process 00000000 *und* 00000000 puts 00000358 g F. Text
0000003c Main
Readelf-h XXX.O
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ readelf-h main.o ELF header:magic:7f 4c 46 01 01 01 00 00 0 0 Class:elf32 Data:2 ' s complement, Littl E endian Version:1 (current) Os/abi:unix-system V ABI Versi on:0 Type:rel (relocatable file) Machine: MIPS R3000 version:0x1 Entry Point address:0x0 Start of the program headers : 0 (bytes into file) Start of the Section headers:1624 (bytes to file) Flags: 0x1005, Noreorder, CPIC, O32, mips1 size of this header:52 (bytes) Size of the program headers: 0 (bytes) Number of program headers:0 Size of Section headers:40 (bytes) Number of Headers:15 SeCtion Header String Table Index:12
Readelf-s MAIN.O
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ readelf-s main.o Symbol table '. Symtab ' contains Entries:num : Value Size Type Bind Vis Ndx Name 0:00000000 0 notype local DEFAULT UND 1:00000000 0 FI LE Local default ABS main.c 2:00000000 0 section local default 1 3:00000000 0 section Local default 3 4:00000000 0 Section local default 4 5:00000000 0 section 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 10:00000000 0 section local default 11:00000000 FUNC GLOBAL default 1 demo1 12:00000000 0 notype GLOBAL default UND getidchipserialno 13:00000000 0 notype GLOBAL default UND printf 14:00000000 0 notype Global default UND putchar 15:000000DC 636 FUNC GLOBAL Defaul T 1 Demo2 16:00000000 0 notype GLOBAL DEFAULT UND _alpu_rand 17:00000000 0 notype GLOBAL default UND gettimeofday 18:00000000 0 Notype Global Default UND alpuc_process 19:00000000 0 notype GLOBAL DEFAULT UND puts 20:00000358
GLOBAL DEFAULT 1 Main
NM XXX.O contrasts the differences between the symbol tables generated by the g++ compiler and the GCC generation.
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ nm MAIN.O #g + + compile
u _z10_alpu_randv
u _z13alpuc_ Processphs_
u _z17getidchipserialnoph
00000000 T _z5demo1v
000000dc T _z5demo2v
u gettimeofday
00000358 T main
u printf
u putchar u
puts
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ Mipsel-openwrt-linux-gcc-c main.c
mipsel-openwrt-linux-gcc:warning:environment variable ' STAGING_DIR ' not Defined
weeds@weeds-thinkpad-t440p:~/documents/encrypchip$ nm main.o #gcc compile
U getidchipserialno
U _alpu_rand
U alpuc_process
00000000 T demo1
000000dc T demo2
u gettimeofday
t main
u printf
U Putchar
U puts