先编译一个简单的 C 程序。
#include <stdio.h>
char* s = "Hello, World!";
char* x;
int i = 0x1234;
int main(int argc, char* argv[])
{
x = "Ubuntu";
printf("%s/n", s);
return 0;
}
编译后,使用 objdump 输出 ELF Section 信息。我们通常关心只有 .text, .rodata, .data, .bss 这几个段。
yuhen@yuhen-desktop:~/Learn.c$ objdump -h hello
hello: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
12 .text 0000018c 08048310 08048310 00000310 2**4
CONTENTS, ALLOC, LOAD, READON......
阅读全文