readelf -l /bin/bash
給了我這樣的:ELF程序頭:MemSiz與FileSiz
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040 0x00000000000001f8 0x00000000000001f8 R E 8 INTERP 0x0000000000000238 0x0000000000400238 0x0000000000400238 0x000000000000001a 0x000000000000001a R 1 [Requesting program interpreter: /lib/ld-linux-x86-64.so.2] LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000 0x00000000000aeef4 0x00000000000aeef4 R E 200000 LOAD 0x00000000000afde0 0x00000000006afde0 0x00000000006afde0 0x0000000000003cec 0x000000000000d3c8 RW 200000 DYNAMIC 0x00000000000afdf8 0x00000000006afdf8 0x00000000006afdf8 0x0000000000000200 0x0000000000000200 RW 8 NOTE 0x0000000000000254 0x0000000000400254 0x0000000000400254 0x0000000000000044 0x0000000000000044 R 4 GNU_EH_FRAME 0x000000000009dbc0 0x000000000049dbc0 0x000000000049dbc0 0x0000000000002bb4 0x0000000000002bb4 R 4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 8 GNU_RELRO 0x00000000000afde0 0x00000000006afde0 0x00000000006afde0 0x0000000000000220 0x0000000000000220 R 1
爲什麼MemSiz
不等於FileSiz
一些LOAD
段? MemSiz
包含的內存區域應該做些什麼,但不是FileSiz
?
這取決於該細分代表什麼。 –
它包含以下幾部分: '.init_array .fini_array .jcr .dynamic .got .got.plt .data .bss' – gvl
那麼''.bss'節總是被加載器清零。所以在文件中引入大量的零是毫無意義的。 –