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.early 0x0 : AT ( _text16_early_lma ) {
51 . += 1; /* Prevent NULL being valid */
55 } .text16.late ALIGN ( _max_align ) : AT ( _text16_late_lma ) {
60 } .bss.text16 (NOLOAD) : AT ( _end_lma ) {
63 _text16_early_filesz = ABSOLUTE ( _etext16_early - _text16 );
64 _text16_early_memsz = ABSOLUTE ( _etext16_early - _text16 );
65 _text16_late_filesz = ABSOLUTE ( _mtext16 - _text16_late );
66 _text16_late_memsz = ABSOLUTE ( _etext16 - _text16_late );
67 _text16_memsz = ABSOLUTE ( _etext16 - _text16 );
70 * The 16-bit (real-mode) data section
74 .data16 0x0 : AT ( _data16_lma ) {
76 . += 1; /* Prevent NULL being valid */
82 } .bss.data16 (NOLOAD) : AT ( _end_lma ) {
89 _data16_filesz = ABSOLUTE ( _mdata16 - _data16 );
90 _data16_memsz = ABSOLUTE ( _edata16 - _data16 );
97 .textdata 0x0 : AT ( _textdata_lma ) {
100 . += 1; /* Prevent NULL being valid */
107 *(SORT(.tbl.*)) /* Various tables. See include/tables.h */
109 } .bss.textdata (NOLOAD) : AT ( _end_lma ) {
117 _textdata_filesz = ABSOLUTE ( _mtextdata - _textdata );
118 _textdata_memsz = ABSOLUTE ( _etextdata - _textdata );
121 * Compressor information block
125 .zinfo 0x0 : AT ( _zinfo_lma ) {
130 } .bss.zinfo (NOLOAD) : AT ( _end_lma ) {
133 _zinfo_filesz = ABSOLUTE ( _mzinfo - _zinfo );
134 _zinfo_memsz = ABSOLUTE ( _ezinfo - _zinfo );
137 * Weak symbols that need zero values if not otherwise defined
141 .weak 0x0 : AT ( _end_lma ) {
146 _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
149 * Dispose of the comment and note sections to make the link map
167 * Load address calculations. In older versions of ld, ALIGN()
168 * can operate only on the location counter, so we use that.
172 PROVIDE ( _max_align = 16 );
175 . = ALIGN ( _max_align );
179 . = ALIGN ( _max_align );
180 _text16_early_lma = .;
181 . += _text16_early_filesz;
183 . = ALIGN ( _max_align );
185 _text16_late_lma = .;
186 . += _text16_late_filesz;
188 . = ALIGN ( _max_align );
192 . = ALIGN ( _max_align );
194 . += _textdata_filesz;
196 _filesz = .; /* Do not include zinfo block in file size */
198 . = ALIGN ( _max_align );
202 . = ALIGN ( _max_align );
206 * Values calculated to save code from doing it
209 _text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
210 _data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );