Basic Linker Script Concepts

Source: Internet
Author: User
Basic Linker Script Concepts

Every loadable or allocatable output section has two addresses. The first isVMA, Or virtual memory address. This is the address the section will have when the output file is run. The second isLMA, Or load memory address. This is the address at which the section will be loaded.

You can see the sections in an object file by usingobjdumpProgram with the-h option.
For example
Objdump XX.exe-h

Stage1.exec.exe: file format pei-i386

Sections:
Idx Name Size vma lma File off Algn
0. text 00000200 running 7c00 running 7c00 000001f0 2 ** 4
CONTENTS, ALLOC, LOAD, CODE
1. stab 000006c0 00007e00 00007e00 000003f0 2 *** 2
CONTENTS, READONLY, DEBUGGING
2. stabstr 00000038 limit 84c0 limit 84c0 00000bf0 2 ** 0
CONTENTS, READONLY, DEBUGGING

You can see the symbols in an object file by usingnmProgram, or by usingobjdumpProgram with the-t option.

For example
Objdump XX.exe-t

Stage1.exec.exe: file format pei-i386

Symbol table:
[0] (sec-2) (fl 0x00) (ty 0) (aq0 103) (nx 1) 0x00000002 stage1.S
File
[2] (sec-2) (fl 0x00) (ty 0) (aq0 103) (nx 1) 0x00000004 stage1.S
File
[4] (sec-2) (fl 0x00) (ty 0) (scl 103) (nx 1) 0x00000006./stage1.h
File
[6] (sec-2) (fl 0x00) (ty 0) (aq0 103) (nx 1) 0x00000008 stage1.S
File
[8] (sec-2) (fl 0x00) (ty 0) (scl 103) (nx 1) 0x0000000a <command line>
File
[10] (sec-2) (fl 0x00) (ty 0) (scl 103) (nx 1) 0x0000000c <built-in>
File
[12] (sec-2) (fl 0x00) (ty 0) (scl 103) (nx 1) 0x0000000e c: \ My_Code \ tmp \ grub4dos-0.4.4 \ stage1 //
File
[14] (sec-2) (fl 0x00) (ty 0) (scl 103) (nx 1) 0x0000003f stage1.S
File
[16] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000004a after_BPB
[17] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000004 mode
[18] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000005 disk_address_packet
[19] (sec 1) (fl 0x00) (ty 0) (CL 6) (nx 0) 0x00000005 sectors
[20] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000009 heads
[21] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000000d cylinders
[22] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000000f sector_start
[23] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000010 head_start
[24] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000011 cylinder_start
[25] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000003e stage1_version
[26] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000040 boot_drive
[27] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000041 force_lba
[28] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000042 stage2_address
[29] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000044 stage2_sector
[30] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000048 stage2_segment
[31] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000004b boot_drive_check
[32] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000059 real_start
[33] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000017f icationication_string
[34] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001a7 message
[35] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000000cc chs_mode
[36] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000095 lba_mode
[37] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000149 copy_buffer
[38] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000000dc final_init
[39] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001c3 floppy_probe
[40] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000169 hd_probe_error
[41] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000106 setup_sectors
[42] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000161 geometry_error
[43] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000171 read_error
[44] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000185 geometry_error_string
[45] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000177 general_error
[46] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000018a hd_probe_error_string
[47] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000194 read_error_string
[48] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x00000199 general_error_string
[49] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x0000017d stop
[50] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001b8 nt_magic
[51] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001be part_start
[52] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001be probe_values
[53] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001c6 probe_loop
[54] (sec 1) (fl 0x00) (ty 0) (scl 6) (nx 0) 0x000001da fd_probe_error_string
[55] (sec 1) (fl 0x00) (ty 0) (scl 3) (nx 1) 0x00000000. text
AUX scnlen 0x200 nreloc 1 nlnno 0
[57] (sec 0) (fl 0x00) (ty 0) (scl 3) (nx 1) 0x00000000. data
AUX scnlen 0x0 nreloc 0 nlnno 0
[59] (sec 0) (fl 0x00) (ty 0) (scl 3) (nx 1) 0x00000000. bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[61] (sec 2) (fl 0x00) (ty 0) (scl 3) (nx 1) 0x00000000. stab
AUX scnlen 0x6c0 nreloc 143 nlnno 0
[63] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ rdata_end __
[64] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ data_start __
[65] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00001000 _ size_of_stack_commit __
[66] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00200000 _ size_of_stack_reserve __
[67] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000004 _ major_subsystem_version __
[68] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 edata
[69] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ bss_start __
[70] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00001000 _ size_of_heap_commit __
[71] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ common_start __
[72] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ dll __
[73] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ minor_ OS _version __
[74] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00400000 _ image_base __
[75] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00001000 _ section_alignment __
[76] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 end
[77] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ data_end __
[78] (sec 1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000200 etext
[79] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ bss_end __
[80] (sec 1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ start
[81] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000200 _ file_alignment __
[82] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000004 _ major_ OS _version __
[83] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00100000 _ size_of_heap_reserve __
[84] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000003 _ subsystem __
[85] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00007e00 _ rdata_start __
[86] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000001 _ major_image_version __
[87] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ loader_flags __
[88] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ minor_subsystem_version __
[89] (sec-1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 _ minor_image_version __
[90] (sec 1) (fl 0x00) (ty 0) (scl 2) (nx 0) 0x00000000 start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.