gvl*_*gvl 1 linux elf memory-alignment readelf
readelf -l /bin/bash 给我这个:
程序标题:
类型偏移VirtAddr PhysAddr
FileSiz MemSiz标志对齐
PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040
0x00000000000001f8 0x00000000000001f8 RE 8
INTERP 0x0000000000000238 0x0000000000400238 0x0000000000400238
0x000000000000001a 0x000000000000001a R 1
[请求程序解释器:/lib/ld-linux-x86-64.so.2]
加载0x0000000000000000 0x0000000000400000 0x0000000000400000
0x00000000000aeef4 0x00000000000aeef4稀土200000
加载0x00000000000afde0 0x00000000006afde0 0x00000000006afde0
0x0000000000003cec 0x000000000000d3c8 读写200000
动态0x00000000000afdf8 0x00000000006afdf8 0x00000000006afdf8
0x0000000000000200 0x0000000000000200读写8
注意0x0000000000000254 0x0000000000400254 0x0000000000400254
0x0000000000000044 0x0000000000000044 R 4
GNU_EH_FRAME 0x000000000009dbc0 0x000000000049dbc0 0x000000000049dbc0
0x0000000000002bb4 0x0000000000002bb4 R 4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000读写8
GNU_RELRO 0x00000000000afde0 0x00000000006afde0 0x00000000006afde0
0x0000000000000220 0x0000000000000220 R 1
为什么在某些细分市场中MemSiz不等于?包含但不包含的存储区应该怎么办?FileSizLOADMemSizFileSiz
有问题的可加载段似乎是程序的数据段。
程序中的数据段包含用于初始化和未初始化的程序变量的空间。初始化变量的值存储在程序的可执行文件中。未初始化的程序变量不需要存储在任何地方。而是在名为“ .bss”的特殊零尺寸部分中为它们保留了空间。
因此,可执行文件的数据段的文件大小可以小于其内存中的大小。
为了显示:
/*
* Space for the intialized variable 'x' would be reserved the
* executable's ".data" section, along with its initial value.
*/
int x = 42;
/*
* Space for the uninitialized variable 'y' would be reserved in
* the ".bss" section; no file space would be allocated in the
* executable.
*/
int y;
Run Code Online (Sandbox Code Playgroud)
在类Unix系统上,映射到“ .bss”节的数据段部分将在程序加载时填充零。
| 归档时间: |
|
| 查看次数: |
952 次 |
| 最近记录: |