赞
踩
1 需求
查看ELF依赖库
查看ELF section header
查看各个section具体内容
查看静态符号表、动态符号表
查看字符串符号表、指定wection具体内容
2 语法
3 示例
- #include <stdio.h>
-
- const char varConst[] = "I am const var";
- char varGlobal[] = "I am global var";
- char varGlobalNull;
-
- int main() {
- static char varStatic[] = "I am static var";
- char varLocal[] = "I am local var";
- char varLocalNull;
- printf("%s\n", varConst);
- printf("%s\n", varGlobal);
- printf("%s\n", varStatic);
- printf("%s\n", varLocal);
- return 0;
- }
gcc -o main main.c
3 示例:
file main
main: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=a69faf64ea4b1fd4ea2df0916499848d1c09609f, not stripped
size main
- text data bss dec hex filename
- 1726 640 8 2374 946 main
3 示例:
ldd main
- linux-vdso.so.1 (0x00007ffe6b5e8000)
- libgtk3-nocsd.so.0 => /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f92bb71c000)
- libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f92bb32b000)
- libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f92bb127000)
- libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f92baf08000)
- /lib64/ld-linux-x86-64.so.2 (0x00007f92bbb25000)
readelf -d main | grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
3 示例:
readelf -S --wide main
- There are 29 section headers, starting at offset 0x1a10:
-
- Section Headers:
- [Nr] Name Type Address Off Size ES Flg Lk Inf Al
- [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
- [ 1] .interp PROGBITS 0000000000000238 000238 00001c 00 A 0 0 1
- [ 2] .note.ABI-tag NOTE 0000000000000254 000254 000020 00 A 0 0 4
- [ 3] .note.gnu.build-id NOTE 0000000000000274 000274 000024 00 A 0 0 4
- [ 4] .gnu.hash GNU_HASH 0000000000000298 000298 00001c 00 A 5 0 8
- [ 5] .dynsym DYNSYM 00000000000002b8 0002b8 0000c0 18 A 6 1 8
- [ 6] .dynstr STRTAB 0000000000000378 000378 00009d 00 A 0 0 1
- [ 7] .gnu.version VERSYM 0000000000000416 000416 000010 02 A 5 0 2
- [ 8] .gnu.version_r VERNEED 0000000000000428 000428 000030 00 A 6 1 8
- [ 9] .rela.dyn RELA 0000000000000458 000458 0000c0 18 A 5 0 8
- [10] .rela.plt RELA 0000000000000518 000518 000030 18 AI 5 22 8
- [11] .init PROGBITS 0000000000000548 000548 000017 00 AX 0 0 4
- [12] .plt PROGBITS 0000000000000560 000560 000030 10 AX 0 0 16
- [13] .plt.got PROGBITS 0000000000000590 000590 000008 08 AX 0 0 8
- [14] .text PROGBITS 00000000000005a0 0005a0 000202 00 AX 0 0 16
- [15] .fini PROGBITS 00000000000007a4 0007a4 000009 00 AX 0 0 4
- [16] .rodata PROGBITS 00000000000007b0 0007b0 000017 00 A 0 0 8
- [17] .eh_frame_hdr PROGBITS 00000000000007c8 0007c8 00003c 00 A 0 0 4
- [18] .eh_frame PROGBITS 0000000000000808 000808 000108 00 A 0 0 8
- [19] .init_array INIT_ARRAY 0000000000200db0 000db0 000008 08 WA 0 0 8
- [20] .fini_array FINI_ARRAY 0000000000200db8 000db8 000008 08 WA 0 0 8
- [21] .dynamic DYNAMIC 0000000000200dc0 000dc0 0001f0 10 WA 6 0 8
- [22] .got PROGBITS 0000000000200fb0 000fb0 000050 08 WA 0 0 8
- [23] .data PROGBITS 0000000000201000 001000 000030 00 WA 0 0 16
- [24] .bss NOBITS 0000000000201030 001030 000008 00 WA 0 0 1
- [25] .comment PROGBITS 0000000000000000 001030 000029 01 MS 0 0 1
- [26] .symtab SYMTAB 0000000000000000 001060 000660 18 27 44 8
- [27] .strtab STRTAB 0000000000000000 0016c0 00024e 00 0 0 1
- [28] .shstrtab STRTAB 0000000000000000 00190e 0000fe 00 0 0 1
- Key to Flags:
- W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
- L (link order), O (extra OS processing required), G (group), T (TLS),
- C (compressed), x (unknown), o (OS specific), E (exclude),
- l (large), p (processor specific)
3 示例:
objdump -s --wide main
- main: file format elf64-x86-64
-
- Contents of section .interp:
- 0238 2f6c6962 36342f6c 642d6c69 6e75782d /lib64/ld-linux-
- 0248 7838362d 36342e73 6f2e3200 x86-64.so.2.
- Contents of section .note.ABI-tag:
- 0254 04000000 10000000 01000000 474e5500 ............GNU.
- 0264 00000000 03000000 02000000 00000000 ................
- Contents of section .note.gnu.build-id:
- 0274 04000000 14000000 03000000 474e5500 ............GNU.
- 0284 a69faf64 ea4b1fd4 ea2df091 6499848d ...d.K...-..d...
- 0294 1c09609f ..`.
- Contents of section .gnu.hash:
- 0298 01000000 01000000 01000000 00000000 ................
- 02a8 00000000 00000000 00000000 ............
- Contents of section .dynsym:
- 02b8 00000000 00000000 00000000 00000000 ................
- 02c8 00000000 00000000 58000000 20000000 ........X... ...
- 02d8 00000000 00000000 00000000 00000000 ................
- 02e8 0b000000 12000000 00000000 00000000 ................
- 02f8 00000000 00000000 10000000 12000000 ................
- 0308 00000000 00000000 00000000 00000000 ................
- 0318 30000000 12000000 00000000 00000000 0...............
- 0328 00000000 00000000 74000000 20000000 ........t... ...
- 0338 00000000 00000000 00000000 00000000 ................
- 0348 83000000 20000000 00000000 00000000 .... ...........
- 0358 00000000 00000000 21000000 22000000 ........!..."...
- 0368 00000000 00000000 00000000 00000000 ................
- Contents of section .dynstr:
- 0378 006c6962 632e736f 2e360070 75747300 .libc.so.6.puts.
- 0388 5f5f7374 61636b5f 63686b5f 6661696c __stack_chk_fail
- 0398 005f5f63 78615f66 696e616c 697a6500 .__cxa_finalize.
- 03a8 5f5f6c69 62635f73 74617274 5f6d6169 __libc_start_mai
- 03b8 6e00474c 4942435f 322e3400 474c4942 n.GLIBC_2.4.GLIB
- 03c8 435f322e 322e3500 5f49544d 5f646572 C_2.2.5._ITM_der
- 03d8 65676973 74657254 4d436c6f 6e655461 egisterTMCloneTa
- 03e8 626c6500 5f5f676d 6f6e5f73 74617274 ble.__gmon_start
- 03f8 5f5f005f 49544d5f 72656769 73746572 __._ITM_register
- 0408 544d436c 6f6e6554 61626c65 00 TMCloneTable.
- Contents of section .gnu.version:
- 0416 00000000 02000300 02000000 00000200 ................
- Contents of section .gnu.version_r:
- 0428 01000200 01000000 10000000 00000000 ................
- 0438 1469690d 00000300 42000000 10000000 .ii.....B.......
- 0448 751a6909 00000200 4c000000 00000000 u.i.....L.......
- Contents of section .rela.dyn:
- 0458 b00d2000 00000000 08000000 00000000 .. .............
- 0468 a0060000 00000000 b80d2000 00000000 .......... .....
- 0478 08000000 00000000 60060000 00000000 ........`.......
- 0488 08102000 00000000 08000000 00000000 .. .............
- 0498 08102000 00000000 d80f2000 00000000 .. ....... .....
- 04a8 06000000 01000000 00000000 00000000 ................
- 04b8 e00f2000 00000000 06000000 04000000 .. .............
- 04c8 00000000 00000000 e80f2000 00000000 .......... .....
- 04d8 06000000 05000000 00000000 00000000 ................
- 04e8 f00f2000 00000000 06000000 06000000 .. .............
- 04f8 00000000 00000000 f80f2000 00000000 .......... .....
- 0508 06000000 07000000 00000000 00000000 ................
- Contents of section .rela.plt:
- 0518 c80f2000 00000000 07000000 02000000 .. .............
- 0528 00000000 00000000 d00f2000 00000000 .......... .....
- 0538 07000000 03000000 00000000 00000000 ................
- Contents of section .init:
- 0548 4883ec08 488b0595 0a200048 85c07402 H...H.... .H..t.
- 0558 ffd04883 c408c3 ..H....
- Contents of section .plt:
- 0560 ff35520a 2000ff25 540a2000 0f1f4000 .5R. ..%T. ...@.
- 0570 ff25520a 20006800 000000e9 e0ffffff .%R. .h.........
- 0580 ff254a0a 20006801 000000e9 d0ffffff .%J. .h.........
- Contents of section .plt.got:
- 0590 ff25620a 20006690 .%b. .f.
- Contents of section .text:
- 05a0 31ed4989 d15e4889 e24883e4 f050544c 1.I..^H..H...PTL
- 05b0 8d05ea01 0000488d 0d730100 00488d3d ......H..s...H.=
- 05c0 e6000000 ff15160a 2000f40f 1f440000 ........ ....D..
- 05d0 488d3d59 0a200055 488d0551 0a200048 H.=Y. .UH..Q. .H
- 05e0 39f84889 e5741948 8b05ea09 20004885 9.H..t.H.... .H.
- 05f0 c0740d5d ffe0662e 0f1f8400 00000000 .t.]..f.........
- 0600 5dc30f1f 4000662e 0f1f8400 00000000 ]...@.f.........
- 0610 488d3d19 0a200048 8d35120a 20005548 H.=.. .H.5.. .UH
- 0620 29fe4889 e548c1fe 034889f0 48c1e83f ).H..H...H..H..?
- 0630 4801c648 d1fe7418 488b05b1 09200048 H..H..t.H.... .H
- 0640 85c0740c 5dffe066 0f1f8400 00000000 ..t.]..f........
- 0650 5dc30f1f 4000662e 0f1f8400 00000000 ]...@.f.........
- 0660 803dc909 20000075 2f48833d 87092000 .=.. ..u/H.=.. .
- 0670 00554889 e5740c48 8b3d8a09 2000e80d .UH..t.H.=.. ...
- 0680 ffffffe8 48ffffff c605a109 2000015d ....H....... ..]
- 0690 c30f1f80 00000000 f3c3660f 1f440000 ..........f..D..
- 06a0 554889e5 5de966ff ffff5548 89e54883 UH..].f...UH..H.
- 06b0 ec206448 8b042528 00000048 8945f831 . dH..%(...H.E.1
- 06c0 c048b849 20616d20 6c6f6348 8945e9c7 .H.I am locH.E..
- 06d0 45f1616c 207666c7 45f56172 c645f700 E.al vf.E.ar.E..
- 06e0 488d3dd1 000000e8 84feffff 488d3d1d H.=.........H.=.
- 06f0 092000e8 78feffff 488d3d21 092000e8 . ..x...H.=!. ..
- 0700 6cfeffff 488d45e9 4889c7e8 60feffff l...H.E.H...`...
- 0710 b8000000 00488b55 f8644833 14252800 .....H.U.dH3.%(.
- 0720 00007405 e857feff ffc9c30f 1f440000 ..t..W.......D..
- 0730 41574156 4989d741 5541544c 8d256e06 AWAVI..AUATL.%n.
- 0740 20005548 8d2d6e06 20005341 89fd4989 .UH.-n. .SA..I.
- 0750 f64c29e5 4883ec08 48c1fd03 e8e7fdff .L).H...H.......
- 0760 ff4885ed 742031db 0f1f8400 00000000 .H..t 1.........
- 0770 4c89fa4c 89f64489 ef41ff14 dc4883c3 L..L..D..A...H..
- 0780 014839dd 75ea4883 c4085b5d 415c415d .H9.u.H...[]A\A]
- 0790 415e415f c390662e 0f1f8400 00000000 A^A_..f.........
- 07a0 f3c3 ..
- Contents of section .fini:
- 07a4 4883ec08 4883c408 c3 H...H....
- Contents of section .rodata:
- 07b0 01000200 00000000 4920616d 20636f6e ........I am con
- 07c0 73742076 617200 st var.
- Contents of section .eh_frame_hdr:
- 07c8 011b033b 3c000000 06000000 98fdffff ...;<...........
- 07d8 88000000 c8fdffff b0000000 d8fdffff ................
- 07e8 58000000 e2feffff c8000000 68ffffff X...........h...
- 07f8 e8000000 d8ffffff 30010000 ........0...
- Contents of section .eh_frame:
- 0808 14000000 00000000 017a5200 01781001 .........zR..x..
- 0818 1b0c0708 90010710 14000000 1c000000 ................
- 0828 78fdffff 2b000000 00000000 00000000 x...+...........
- 0838 14000000 00000000 017a5200 01781001 .........zR..x..
- 0848 1b0c0708 90010000 24000000 1c000000 ........$.......
- 0858 08fdffff 30000000 000e1046 0e184a0f ....0......F..J.
- 0868 0b770880 003f1a3b 2a332422 00000000 .w...?.;*3$"....
- 0878 14000000 44000000 10fdffff 08000000 ....D...........
- 0888 00000000 00000000 1c000000 5c000000 ............\...
- 0898 12feffff 81000000 00410e10 8602430d .........A....C.
- 08a8 06027c0c 07080000 44000000 7c000000 ..|.....D...|...
- 08b8 78feffff 65000000 00420e10 8f02420e x...e....B....B.
- 08c8 188e0345 0e208d04 420e288c 05480e30 ...E. ..B.(..H.0
- 08d8 8606480e 3883074d 0e40720e 38410e30 ..H.8..M.@r.8A.0
- 08e8 410e2842 0e20420e 18420e10 420e0800 A.(B. B..B..B...
- 08f8 10000000 c4000000 a0feffff 02000000 ................
- 0908 00000000 00000000 ........
- Contents of section .init_array:
- 200db0 a0060000 00000000 ........
- Contents of section .fini_array:
- 200db8 60060000 00000000 `.......
- Contents of section .dynamic:
- 200dc0 01000000 00000000 01000000 00000000 ................
- 200dd0 0c000000 00000000 48050000 00000000 ........H.......
- 200de0 0d000000 00000000 a4070000 00000000 ................
- 200df0 19000000 00000000 b00d2000 00000000 .......... .....
- 200e00 1b000000 00000000 08000000 00000000 ................
- 200e10 1a000000 00000000 b80d2000 00000000 .......... .....
- 200e20 1c000000 00000000 08000000 00000000 ................
- 200e30 f5feff6f 00000000 98020000 00000000 ...o............
- 200e40 05000000 00000000 78030000 00000000 ........x.......
- 200e50 06000000 00000000 b8020000 00000000 ................
- 200e60 0a000000 00000000 9d000000 00000000 ................
- 200e70 0b000000 00000000 18000000 00000000 ................
- 200e80 15000000 00000000 00000000 00000000 ................
- 200e90 03000000 00000000 b00f2000 00000000 .......... .....
- 200ea0 02000000 00000000 30000000 00000000 ........0.......
- 200eb0 14000000 00000000 07000000 00000000 ................
- 200ec0 17000000 00000000 18050000 00000000 ................
- 200ed0 07000000 00000000 58040000 00000000 ........X.......
- 200ee0 08000000 00000000 c0000000 00000000 ................
- 200ef0 09000000 00000000 18000000 00000000 ................
- 200f00 1e000000 00000000 08000000 00000000 ................
- 200f10 fbffff6f 00000000 01000008 00000000 ...o............
- 200f20 feffff6f 00000000 28040000 00000000 ...o....(.......
- 200f30 ffffff6f 00000000 01000000 00000000 ...o............
- 200f40 f0ffff6f 00000000 16040000 00000000 ...o............
- 200f50 f9ffff6f 00000000 03000000 00000000 ...o............
- 200f60 00000000 00000000 00000000 00000000 ................
- 200f70 00000000 00000000 00000000 00000000 ................
- 200f80 00000000 00000000 00000000 00000000 ................
- 200f90 00000000 00000000 00000000 00000000 ................
- 200fa0 00000000 00000000 00000000 00000000 ................
- Contents of section .got:
- 200fb0 c00d2000 00000000 00000000 00000000 .. .............
- 200fc0 00000000 00000000 76050000 00000000 ........v.......
- 200fd0 86050000 00000000 00000000 00000000 ................
- 200fe0 00000000 00000000 00000000 00000000 ................
- 200ff0 00000000 00000000 00000000 00000000 ................
- Contents of section .data:
- 201000 00000000 00000000 08102000 00000000 .......... .....
- 201010 4920616d 20676c6f 62616c20 76617200 I am global var.
- 201020 4920616d 20737461 74696320 76617200 I am static var.
- Contents of section .comment:
- 0000 4743433a 20285562 756e7475 20372e35 GCC: (Ubuntu 7.5
- 0010 2e302d33 7562756e 7475317e 31382e30 .0-3ubuntu1~18.0
- 0020 34292037 2e352e30 00 4) 7.5.0.
3 示例:
readelf -s main
- Symbol table '.dynsym' contains 8 entries:
- Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
- 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
- 3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (3)
- 4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
- 5: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
- 6: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
- 7: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
-
- Symbol table '.symtab' contains 68 entries:
- Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000238 0 SECTION LOCAL DEFAULT 1
- 2: 0000000000000254 0 SECTION LOCAL DEFAULT 2
- 3: 0000000000000274 0 SECTION LOCAL DEFAULT 3
- 4: 0000000000000298 0 SECTION LOCAL DEFAULT 4
- 5: 00000000000002b8 0 SECTION LOCAL DEFAULT 5
- 6: 0000000000000378 0 SECTION LOCAL DEFAULT 6
- 7: 0000000000000416 0 SECTION LOCAL DEFAULT 7
- 8: 0000000000000428 0 SECTION LOCAL DEFAULT 8
- 9: 0000000000000458 0 SECTION LOCAL DEFAULT 9
- 10: 0000000000000518 0 SECTION LOCAL DEFAULT 10
- 11: 0000000000000548 0 SECTION LOCAL DEFAULT 11
- 12: 0000000000000560 0 SECTION LOCAL DEFAULT 12
- 13: 0000000000000590 0 SECTION LOCAL DEFAULT 13
- 14: 00000000000005a0 0 SECTION LOCAL DEFAULT 14
- 15: 00000000000007a4 0 SECTION LOCAL DEFAULT 15
- 16: 00000000000007b0 0 SECTION LOCAL DEFAULT 16
- 17: 00000000000007c8 0 SECTION LOCAL DEFAULT 17
- 18: 0000000000000808 0 SECTION LOCAL DEFAULT 18
- 19: 0000000000200db0 0 SECTION LOCAL DEFAULT 19
- 20: 0000000000200db8 0 SECTION LOCAL DEFAULT 20
- 21: 0000000000200dc0 0 SECTION LOCAL DEFAULT 21
- 22: 0000000000200fb0 0 SECTION LOCAL DEFAULT 22
- 23: 0000000000201000 0 SECTION LOCAL DEFAULT 23
- 24: 0000000000201030 0 SECTION LOCAL DEFAULT 24
- 25: 0000000000000000 0 SECTION LOCAL DEFAULT 25
- 26: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
- 27: 00000000000005d0 0 FUNC LOCAL DEFAULT 14 deregister_tm_clones
- 28: 0000000000000610 0 FUNC LOCAL DEFAULT 14 register_tm_clones
- 29: 0000000000000660 0 FUNC LOCAL DEFAULT 14 __do_global_dtors_aux
- 30: 0000000000201030 1 OBJECT LOCAL DEFAULT 24 completed.7698
- 31: 0000000000200db8 0 OBJECT LOCAL DEFAULT 20 __do_global_dtors_aux_fin
- 32: 00000000000006a0 0 FUNC LOCAL DEFAULT 14 frame_dummy
- 33: 0000000000200db0 0 OBJECT LOCAL DEFAULT 19 __frame_dummy_init_array_
- 34: 0000000000000000 0 FILE LOCAL DEFAULT ABS main.c
- 35: 0000000000201020 16 OBJECT LOCAL DEFAULT 23 varStatic.2252
- 36: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
- 37: 000000000000090c 0 OBJECT LOCAL DEFAULT 18 __FRAME_END__
- 38: 0000000000000000 0 FILE LOCAL DEFAULT ABS
- 39: 0000000000200db8 0 NOTYPE LOCAL DEFAULT 19 __init_array_end
- 40: 0000000000200dc0 0 OBJECT LOCAL DEFAULT 21 _DYNAMIC
- 41: 0000000000200db0 0 NOTYPE LOCAL DEFAULT 19 __init_array_start
- 42: 00000000000007c8 0 NOTYPE LOCAL DEFAULT 17 __GNU_EH_FRAME_HDR
- 43: 0000000000200fb0 0 OBJECT LOCAL DEFAULT 22 _GLOBAL_OFFSET_TABLE_
- 44: 00000000000007a0 2 FUNC GLOBAL DEFAULT 14 __libc_csu_fini
- 45: 0000000000201010 16 OBJECT GLOBAL DEFAULT 23 varGlobal
- 46: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
- 47: 0000000000201000 0 NOTYPE WEAK DEFAULT 23 data_start
- 48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5
- 49: 0000000000201030 0 NOTYPE GLOBAL DEFAULT 23 _edata
- 50: 00000000000007a4 0 FUNC GLOBAL DEFAULT 15 _fini
- 51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@@GLIBC_2
- 52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
- 53: 0000000000201000 0 NOTYPE GLOBAL DEFAULT 23 __data_start
- 54: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
- 55: 0000000000201008 0 OBJECT GLOBAL HIDDEN 23 __dso_handle
- 56: 00000000000007b0 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
- 57: 0000000000000730 101 FUNC GLOBAL DEFAULT 14 __libc_csu_init
- 58: 0000000000201038 0 NOTYPE GLOBAL DEFAULT 24 _end
- 59: 00000000000005a0 43 FUNC GLOBAL DEFAULT 14 _start
- 60: 0000000000201030 0 NOTYPE GLOBAL DEFAULT 24 __bss_start
- 61: 00000000000006aa 129 FUNC GLOBAL DEFAULT 14 main
- 62: 0000000000201030 0 OBJECT GLOBAL HIDDEN 23 __TMC_END__
- 63: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
- 64: 00000000000007b8 15 OBJECT GLOBAL DEFAULT 16 varConst
- 65: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@@GLIBC_2.2
- 66: 0000000000000548 0 FUNC GLOBAL DEFAULT 11 _init
- 67: 0000000000201031 1 OBJECT GLOBAL DEFAULT 24 varGlobalNull
readelf --dyn-sym main
- Symbol table '.dynsym' contains 8 entries:
- Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
- 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
- 3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (3)
- 4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
- 5: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
- 6: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
- 7: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
objdump -t main
- main: file format elf64-x86-64
-
- SYMBOL TABLE:
- 0000000000000238 l d .interp 0000000000000000 .interp
- 0000000000000254 l d .note.ABI-tag 0000000000000000 .note.ABI-tag
- 0000000000000274 l d .note.gnu.build-id 0000000000000000 .note.gnu.build-id
- 0000000000000298 l d .gnu.hash 0000000000000000 .gnu.hash
- 00000000000002b8 l d .dynsym 0000000000000000 .dynsym
- 0000000000000378 l d .dynstr 0000000000000000 .dynstr
- 0000000000000416 l d .gnu.version 0000000000000000 .gnu.version
- 0000000000000428 l d .gnu.version_r 0000000000000000 .gnu.version_r
- 0000000000000458 l d .rela.dyn 0000000000000000 .rela.dyn
- 0000000000000518 l d .rela.plt 0000000000000000 .rela.plt
- 0000000000000548 l d .init 0000000000000000 .init
- 0000000000000560 l d .plt 0000000000000000 .plt
- 0000000000000590 l d .plt.got 0000000000000000 .plt.got
- 00000000000005a0 l d .text 0000000000000000 .text
- 00000000000007a4 l d .fini 0000000000000000 .fini
- 00000000000007b0 l d .rodata 0000000000000000 .rodata
- 00000000000007c8 l d .eh_frame_hdr 0000000000000000 .eh_frame_hdr
- 0000000000000808 l d .eh_frame 0000000000000000 .eh_frame
- 0000000000200db0 l d .init_array 0000000000000000 .init_array
- 0000000000200db8 l d .fini_array 0000000000000000 .fini_array
- 0000000000200dc0 l d .dynamic 0000000000000000 .dynamic
- 0000000000200fb0 l d .got 0000000000000000 .got
- 0000000000201000 l d .data 0000000000000000 .data
- 0000000000201030 l d .bss 0000000000000000 .bss
- 0000000000000000 l d .comment 0000000000000000 .comment
- 0000000000000000 l df *ABS* 0000000000000000 crtstuff.c
- 00000000000005d0 l F .text 0000000000000000 deregister_tm_clones
- 0000000000000610 l F .text 0000000000000000 register_tm_clones
- 0000000000000660 l F .text 0000000000000000 __do_global_dtors_aux
- 0000000000201030 l O .bss 0000000000000001 completed.7698
- 0000000000200db8 l O .fini_array 0000000000000000 __do_global_dtors_aux_fini_array_entry
- 00000000000006a0 l F .text 0000000000000000 frame_dummy
- 0000000000200db0 l O .init_array 0000000000000000 __frame_dummy_init_array_entry
- 0000000000000000 l df *ABS* 0000000000000000 main.c
- 0000000000201020 l O .data 0000000000000010 varStatic.2252
- 0000000000000000 l df *ABS* 0000000000000000 crtstuff.c
- 000000000000090c l O .eh_frame 0000000000000000 __FRAME_END__
- 0000000000000000 l df *ABS* 0000000000000000
- 0000000000200db8 l .init_array 0000000000000000 __init_array_end
- 0000000000200dc0 l O .dynamic 0000000000000000 _DYNAMIC
- 0000000000200db0 l .init_array 0000000000000000 __init_array_start
- 00000000000007c8 l .eh_frame_hdr 0000000000000000 __GNU_EH_FRAME_HDR
- 0000000000200fb0 l O .got 0000000000000000 _GLOBAL_OFFSET_TABLE_
- 00000000000007a0 g F .text 0000000000000002 __libc_csu_fini
- 0000000000201010 g O .data 0000000000000010 varGlobal
- 0000000000000000 w *UND* 0000000000000000 _ITM_deregisterTMCloneTable
- 0000000000201000 w .data 0000000000000000 data_start
- 0000000000000000 F *UND* 0000000000000000 puts@@GLIBC_2.2.5
- 0000000000201030 g .data 0000000000000000 _edata
- 00000000000007a4 g F .fini 0000000000000000 _fini
- 0000000000000000 F *UND* 0000000000000000 __stack_chk_fail@@GLIBC_2.4
- 0000000000000000 F *UND* 0000000000000000 __libc_start_main@@GLIBC_2.2.5
- 0000000000201000 g .data 0000000000000000 __data_start
- 0000000000000000 w *UND* 0000000000000000 __gmon_start__
- 0000000000201008 g O .data 0000000000000000 .hidden __dso_handle
- 00000000000007b0 g O .rodata 0000000000000004 _IO_stdin_used
- 0000000000000730 g F .text 0000000000000065 __libc_csu_init
- 0000000000201038 g .bss 0000000000000000 _end
- 00000000000005a0 g F .text 000000000000002b _start
- 0000000000201030 g .bss 0000000000000000 __bss_start
- 00000000000006aa g F .text 0000000000000081 main
- 0000000000201030 g O .data 0000000000000000 .hidden __TMC_END__
- 0000000000000000 w *UND* 0000000000000000 _ITM_registerTMCloneTable
- 00000000000007b8 g O .rodata 000000000000000f varConst
- 0000000000000000 w F *UND* 0000000000000000 __cxa_finalize@@GLIBC_2.2.5
- 0000000000000548 g F .init 0000000000000000 _init
- 0000000000201031 g O .bss 0000000000000001 varGlobalNull
objdump -T main
- main: file format elf64-x86-64
-
- DYNAMIC SYMBOL TABLE:
- 0000000000000000 w D *UND* 0000000000000000 _ITM_deregisterTMCloneTable
- 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 puts
- 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.4 __stack_chk_fail
- 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 __libc_start_main
- 0000000000000000 w D *UND* 0000000000000000 __gmon_start__
- 0000000000000000 w D *UND* 0000000000000000 _ITM_registerTMCloneTable
- 0000000000000000 w DF *UND* 0000000000000000 GLIBC_2.2.5 __cxa_finalize
3 示例:
readelf -p 27 main
- String dump of section '.strtab':
- [ 1] crtstuff.c
- [ c] deregister_tm_clones
- [ 21] __do_global_dtors_aux
- [ 37] completed.7698
- [ 46] __do_global_dtors_aux_fini_array_entry
- [ 6d] frame_dummy
- [ 79] __frame_dummy_init_array_entry
- [ 98] main.c
- [ 9f] varStatic.2252
- [ ae] __FRAME_END__
- [ bc] __init_array_end
- [ cd] _DYNAMIC
- [ d6] __init_array_start
- [ e9] __GNU_EH_FRAME_HDR
- [ fc] _GLOBAL_OFFSET_TABLE_
- [ 112] __libc_csu_fini
- [ 122] varGlobal
- [ 12c] _ITM_deregisterTMCloneTable
- [ 148] puts@@GLIBC_2.2.5
- [ 15a] _edata
- [ 161] __stack_chk_fail@@GLIBC_2.4
- [ 17d] __libc_start_main@@GLIBC_2.2.5
- [ 19c] __data_start
- [ 1a9] __gmon_start__
- [ 1b8] __dso_handle
- [ 1c5] _IO_stdin_used
- [ 1d4] __libc_csu_init
- [ 1e4] __bss_start
- [ 1f0] main
- [ 1f5] __TMC_END__
- [ 201] _ITM_registerTMCloneTable
- [ 21b] varConst
- [ 224] __cxa_finalize@@GLIBC_2.2.5
- [ 240] varGlobalNull
readelf -p 6 main
- String dump of section '.dynstr':
- [ 1] libc.so.6
- [ b] puts
- [ 10] __stack_chk_fail
- [ 21] __cxa_finalize
- [ 30] __libc_start_main
- [ 42] GLIBC_2.4
- [ 4c] GLIBC_2.2.5
- [ 58] _ITM_deregisterTMCloneTable
- [ 74] __gmon_start__
- [ 83] _ITM_registerTMCloneTable
readelf -p 23 main
- String dump of section '.data':
- [ a]
- [ 10] I am global var
- [ 20] I am static var
readelf -p 16 main
- String dump of section '.rodata':
- [ 8] I am const var
readelf -p 24 main
Section '.bss' has no data to dump.
4 参考资料
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。