This is an old revision of the document!
==== gPXE memory layout ==== Currently the linker script for each arch is locate at: * ''src/arch/x86/scripts/efi.lds'' * ''src/arch/i386/scripts/i386-kir.lds'' * ''src/arch/i386/scripts/i386.lds'' We can reference ''src/arch/i386/README.i386'' for the difference between ''i386-kir.lds'' and ''i386.lds'', the ''efi.lds'' should be obvious as its file name that is for Extensible Firmware Interface (EFI). In this note we take the binary linked against ''src/arch/i386/scripts/i386.lds'' linker script for instance. \\ To see the memory layout of an target image, for instance ''gpxe.pxe'', the all driver PXE loadable image. Use one of the following command: * objdump -h bin/gpxe.pxe.tmp * readelf -S bin/gpxe.pxe.tmp It can tell you each section's size and where it will put in the memory while execution(VMA). == objdump -h bin/gpxe.pxe.tmp == <file> bin/gpxe.pxe.tmp: file format elf32-i386 Sections: Idx Name Size VMA LMA File off Algn 0 .prefix 0000081a 00000000 00000000 00000160 2**4 CONTENTS, ALLOC, LOAD, CODE 1 .text16 00000854 00000000 00000820 00000980 2**4 CONTENTS, ALLOC, LOAD, CODE 2 .data16 000004a2 00000000 00001080 000011e0 2**4 CONTENTS, ALLOC, LOAD, DATA 3 .bss.data16 000029a0 000004a8 000963f0 00096540 2**3 ALLOC 4 .textdata 00094e7c 00000000 00001530 00001684 2**2 CONTENTS, ALLOC, LOAD, CODE 5 .bss.textdata 00058b68 00094e80 000963f0 00096580 2**7 ALLOC 6 .zinfo 00000040 00000000 000963b0 00096500 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 7 .debug_abbrev 000346c3 00000000 00000000 00096540 2**0 CONTENTS, READONLY, DEBUGGING 8 .debug_info 002274b7 00000000 00000000 000cac03 2**0 CONTENTS, READONLY, DEBUGGING 9 .debug_line 000384b6 00000000 00000000 002f20ba 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_frame 0001953c 00000000 00000000 0032a570 2**2 CONTENTS, READONLY, DEBUGGING 11 .debug_loc 00091542 00000000 00000000 00343aac 2**0 CONTENTS, READONLY, DEBUGGING 12 .debug_pubnames 0000fffd 00000000 00000000 003d4fee 2**0 CONTENTS, READONLY, DEBUGGING 13 .debug_aranges 00002460 00000000 00000000 003e4feb 2**0 CONTENTS, READONLY, DEBUGGING 14 .debug_ranges 00006f58 00000000 00000000 003e744b 2**0 CONTENTS, READONLY, DEBUGGING 15 .debug_str 0003c4ef 00000000 00000000 003ee3a3 2**0 CONTENTS, READONLY, DEBUGGING </file> \\ To see each symbol's memory location, use one of the following command: * objdump -t bin/gpxe.pxe.tmp * readelf -s bin/gpxe.pxe.tmp == objdump -t bin/gpxe.pxe.tmp | sort -k1 | tail -n 30 == <file> 000ec9e4 g O .bss.textdata 00000000 .hidden obj_dhcppkt 000ec9e4 g O .bss.textdata 00000000 .hidden obj_eapol 000ec9e4 g O .bss.textdata 00000000 .hidden obj_editstring 000ec9e4 g O .bss.textdata 00000000 .hidden obj_hmac 000ec9e4 g O .bss.textdata 00000000 .hidden obj_ib_mcast 000ec9e4 g O .bss.textdata 00000000 .hidden obj_ib_pathrec 000ec9e4 g O .bss.textdata 00000000 .hidden obj_icmp 000ec9e4 g O .bss.textdata 00000000 .hidden obj_iwmgmt 000ec9e4 g O .bss.textdata 00000000 .hidden obj_iwmgmt_cmd 000ec9e4 g O .bss.textdata 00000000 .hidden obj_job 000ec9e4 g O .bss.textdata 00000000 .hidden obj_linebuf 000ec9e4 g O .bss.textdata 00000000 .hidden obj_monojob 000ec9e4 g O .bss.textdata 00000000 .hidden obj_readline 000ec9e4 g O .bss.textdata 00000000 .hidden obj_sec80211 000ec9e4 g O .bss.textdata 00000000 .hidden obj_sha1 000ec9e4 g O .bss.textdata 00000000 .hidden obj_sha1extra 000ec9e4 g O .bss.textdata 00000000 .hidden obj_smbios 000ec9e4 g O .bss.textdata 00000000 .hidden obj_tcp 000ec9e4 g O .bss.textdata 00000000 .hidden obj_wep 000ec9e4 g O .bss.textdata 00000000 .hidden obj_wpa 000ec9e4 g O .bss.textdata 00000000 .hidden obj_wpa_ccmp 000ec9e4 g O .bss.textdata 00000000 .hidden obj_wpa_psk 000ec9e4 g O .bss.textdata 00000000 .hidden obj_wpa_tkip 000ec9e8 g .bss.textdata 00000000 _stack 000ed9e8 g *ABS* 00000000 _textdata_memsz 000ed9e8 g .bss.textdata 00000000 _estack 000ed9e8 g .bss.textdata 00000000 .hidden _etextdata 00400000 g *ABS* 00000000 HIGHMEM_LOADPOINT bin/gpxe.pxe.tmp: file format elf32-i386 SYMBOL TABLE: </file> ==== Current memory usage ====