Linux的可执行文件一般是elf格式的,在这个可执行文件的头部包含了很多重要的信息:如文件格式,加载地址,符号表等。当链接器链接生成可执行文件时,会将程序的加载地址写入可执行文件头。在程序运行时,动态加载器将可执行文件载入文件头指定的加载地址处,并加载该地址,开始从该地址处运行。由此可见,可执行文件的起始地址是在编译时就决定的:
x@QiTianM650-A245:~$ readelf -h dnsmasq.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0xa5d8 Start of program headers: 52 (bytes into file) Start of section headers: 347256 (bytes into file) Flags: 0x5000002, Version5 EABI, <unknown> Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 7 Size of section headers: 40 (bytes) Number of section headers: 36 Section header string table index: 33
标签:可执行文件,00,bytes,headers,地址,Linux,动态,加载 From: https://www.cnblogs.com/DF11G/p/17204413.html