4 * Linker script for i386 images
10 /* Each section starts at a virtual address of zero.
12 * We guarantee alignment of virtual addresses to any alignment
13 * specified by the constituent object files (e.g. via
14 * __attribute__((aligned(x)))). Load addresses are guaranteed
15 * only up to _max_align. Provided that all loader and relocation
16 * code honours _max_align, this means that physical addresses are
17 * also guaranteed up to _max_align.
19 * Note that when using -DKEEP_IT_REAL, the UNDI segments are only
20 * guaranteed to be loaded on a paragraph boundary (i.e. 16-byte
21 * alignment). Using _max_align>16 will therefore not guarantee
22 * >16-byte alignment of physical addresses when -DKEEP_IT_REAL is
23 * used (though virtual addresses will still be fully aligned).
32 .prefix 0x0 : AT ( _prefix_lma ) {
37 } .bss.prefix (NOLOAD) : AT ( _end_lma ) {
40 _prefix_filesz = ABSOLUTE ( _mprefix - _prefix );
41 _prefix_memsz = ABSOLUTE ( _eprefix - _prefix );
44 * The 16-bit (real-mode) code section
48 .text16 0x0 : AT ( _text16_lma ) {
51 . += 1; /* Prevent NULL being valid */
55 } .bss.text16 (NOLOAD) : AT ( _end_lma ) {
58 _text16_filesz = ABSOLUTE ( _mtext16 - _text16 );
59 _text16_memsz = ABSOLUTE ( _etext16 - _text16 );
62 * The 16-bit (real-mode) data section
66 .data16 0x0 : AT ( _data16_lma ) {
68 . += 1; /* Prevent NULL being valid */
74 } .bss.data16 (NOLOAD) : AT ( _end_lma ) {
81 _data16_filesz = ABSOLUTE ( _mdata16 - _data16 );
82 _data16_memsz = ABSOLUTE ( _edata16 - _data16 );
89 .textdata 0x0 : AT ( _textdata_lma ) {
92 . += 1; /* Prevent NULL being valid */
99 *(SORT(.tbl.*)) /* Various tables. See include/tables.h */
101 } .bss.textdata (NOLOAD) : AT ( _end_lma ) {
109 _textdata_filesz = ABSOLUTE ( _mtextdata - _textdata );
110 _textdata_memsz = ABSOLUTE ( _etextdata - _textdata );
113 * Compressor information block
117 .zinfo 0x0 : AT ( _zinfo_lma ) {
122 } .bss.zinfo (NOLOAD) : AT ( _end_lma ) {
125 _zinfo_filesz = ABSOLUTE ( _mzinfo - _zinfo );
126 _zinfo_memsz = ABSOLUTE ( _ezinfo - _zinfo );
129 * Weak symbols that need zero values if not otherwise defined
133 .weak 0x0 : AT ( _end_lma ) {
138 _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
141 * Dispose of the comment and note sections to make the link map
159 * Load address calculations. In older versions of ld, ALIGN()
160 * can operate only on the location counter, so we use that.
164 PROVIDE ( _max_align = 16 );
167 . = ALIGN ( _max_align );
171 . = ALIGN ( _max_align );
176 . = ALIGN ( _max_align );
180 . = ALIGN ( _max_align );
182 . += _textdata_filesz;
184 _filesz = .; /* Do not include zinfo block in file size */
186 . = ALIGN ( _max_align );
190 . = ALIGN ( _max_align );
194 * Values calculated to save code from doing it
197 _prefix_filesz_sect = ( ( _prefix_filesz + 511 ) / 512 );
198 _prefix_memsz_pgh = ( ( _prefix_memsz + 15 ) / 16 );
199 _prefix_memsz_sect = ( ( _prefix_memsz + 511 ) / 512 );
200 _text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
201 _data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );