静态连接3-file_a.o
来源:互联网 发布:2016海关进出口数据 编辑:程序博客网 时间:2024/06/17 22:08
file_a.o和hello.o类似,
他们作为hello的一个输入文件,两者地位差不多
只不过main在hello.o里面
但这不代表什么,程序入口地址默认也不是main呢
而是另外一个模块的_start,_start执行完才去main的
[root@localhost mhello]# readelf -S file_a.o
There are 11 section headers, starting at offset 0x16c:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 000034 000060 00 AX 0 0 4
[ 2] .rel.text REL 00000000 000418 000048 08 9 1 4
[ 3] .data PROGBITS 00000000 000094 000004 00 WA 0 0 4
[ 4] .bss NOBITS 00000000 000098 000000 00 WA 0 0 4
[ 5] .rodata PROGBITS 00000000 000098 000053 00 A 0 0 1
[ 6] .comment PROGBITS 00000000 0000eb 00002d 00 0 0 1
[ 7] .note.GNU-stack PROGBITS 00000000 000118 000000 00 0 0 1
[ 8] .shstrtab STRTAB 00000000 000118 000051 00 0 0 1
[ 9] .symtab SYMTAB 00000000 000324 0000c0 10 10 8 4
[10] .strtab STRTAB 00000000 0003e4 000034 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
[root@localhost mhello]# readelf -s file_a.o
Symbol table '.symtab' contains 12 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 FILE LOCAL DEFAULT ABS file_a.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 5
6: 00000000 0 SECTION LOCAL DEFAULT 7
7: 00000000 0 SECTION LOCAL DEFAULT 6
8: 00000000 4 OBJECT GLOBAL DEFAULT 3 var_public_file_a
9: 00000000 96 FUNC GLOBAL DEFAULT 1 func_file_a
10: 00000000 0 NOTYPE GLOBAL DEFAULT UND puts
11: 00000000 0 NOTYPE GLOBAL DEFAULT UND printf
[root@localhost mhello]# readelf -r file_a.o
Relocation section '.rel.text' at offset 0x418 contains 9 entries:
Offset Info Type Sym.Value Sym. Name
00000008 00000801 R_386_32 00000000 var_public_file_a
0000001a 00000501 R_386_32 00000000 .rodata
0000001f 00000a02 R_386_PC32 00000000 puts
0000002d 00000501 R_386_32 00000000 .rodata
00000032 00000b02 R_386_PC32 00000000 printf
00000046 00000501 R_386_32 00000000 .rodata
0000004b 00000b02 R_386_PC32 00000000 printf
00000052 00000501 R_386_32 00000000 .rodata
00000057 00000a02 R_386_PC32 00000000 puts
[root@localhost mhello]# objdump -S file_a.o
file_a.o: file format elf32-i386
Disassembly of section .text:
00000000 <func_file_a>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: c7 05 00 00 00 00 0b movl $0xb,0x0
d: 00 00 00
10: c7 45 fc 64 00 00 00 movl $0x64,-0x4(%ebp)
17: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e: e8 fc ff ff ff call 1f <func_file_a+0x1f>
23: 8b 45 fc mov -0x4(%ebp),%eax
26: 89 44 24 04 mov %eax,0x4(%esp)
2a: c7 04 24 12 00 00 00 movl $0x12,(%esp)
31: e8 fc ff ff ff call 32 <func_file_a+0x32>
36: 8b 45 08 mov 0x8(%ebp),%eax
39: 01 45 fc add %eax,-0x4(%ebp)
3c: 8b 45 fc mov -0x4(%ebp),%eax
3f: 89 44 24 04 mov %eax,0x4(%esp)
43: c7 04 24 28 00 00 00 movl $0x28,(%esp)
4a: e8 fc ff ff ff call 4b <func_file_a+0x4b>
4f: c7 04 24 43 00 00 00 movl $0x43,(%esp)
56: e8 fc ff ff ff call 57 <func_file_a+0x57>
5b: 8b 45 fc mov -0x4(%ebp),%eax
5e: c9 leave
5f: c3 ret
[root@localhost mhello]#
- 静态连接3-file_a.o
- 静态连接1-hello hello.o file_a.o file_b.so
- 静态连接2-hello.o
- freeImage静态库连接
- 静态连接4-hello
- 静态连接5-hello
- makefile连接静态库
- 多重静态库连接
- 静态连接总结
- 静态连接库
- VC++静态连接库
- cmake连接静态库
- PHP 获取 文件file_a相对于file_b的相对路径
- smart3250中的静态I/O映射情况
- smart3250中的静态I/O映射情况
- 树莓派3B设置静态IP连接无线WIFI
- 使用静态库 静态连接和动态连接
- gcc连接静态库成功,g++连接静态库不成功
- header中的Cache-control参数说明
- C#实例详细解析URL含义
- oracle_SQL中ROWID与ROWNUM的使用
- 24位bmp图片文件头、信息头的二进制数据
- qt 去掉标题栏 保留系统菜单
- 静态连接3-file_a.o
- Myeclipse配置SVN插件操作步骤
- dojo 常用方法
- ajax方式提交带文件上传的表单
- DropDownList设置选定项
- ORACLE数据库表和数据分开导出导入的方法
- Android 挂断电话流程
- 解决方法 Error opening CA private key ../../CA/private/cakey.pem
- 关于Openoffice的Any类型说明