1 /* -*- ld-script -*- */
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).
27 PROVIDE ( _max_align = 16 );
30 * Allow decompressor to require a minimum amount of temporary stack
34 PROVIDE ( _min_decompress_stack = 0 );
41 .prefix 0x0 : AT ( _prefix_lma ) {
44 *(SORT(.pci_devlist.*))
47 } .bss.prefix (NOLOAD) : AT ( _end_lma ) {
50 _prefix_filesz = ABSOLUTE ( _mprefix ) - ABSOLUTE ( _prefix );
51 _prefix_memsz = ABSOLUTE ( _eprefix ) - ABSOLUTE ( _prefix );
54 * The 16-bit (real-mode) code section
58 .text16.early 0x0 : AT ( _text16_early_lma ) {
61 KEEP(*(.text16.null.*))
62 . += 1; /* Prevent NULL being valid */
66 } .text16.late ALIGN ( _max_align ) : AT ( _text16_late_lma ) {
71 } .bss.text16 (NOLOAD) : AT ( _end_lma ) {
74 _text16_early_filesz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 );
75 _text16_early_memsz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 );
76 _text16_late_filesz = ABSOLUTE ( _mtext16 ) - ABSOLUTE ( _text16_late );
77 _text16_late_memsz = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16_late );
78 _text16_memsz = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16 );
81 * The 16-bit (real-mode) data section
85 .data16 0x0 : AT ( _data16_lma ) {
87 . += 1; /* Prevent NULL being valid */
93 } .bss.data16 (NOLOAD) : AT ( _end_lma ) {
98 . = MAX ( ., _mdata16 + _min_decompress_stack );
101 _data16_filesz = ABSOLUTE ( _mdata16 ) - ABSOLUTE ( _data16 );
102 _data16_memsz = ABSOLUTE ( _edata16 ) - ABSOLUTE ( _data16 );
105 * The 32-bit sections
109 .textdata 0x0 : AT ( _textdata_lma ) {
111 KEEP(*(.text.null_trap))
112 KEEP(*(.text.null_trap.*))
113 . += 1; /* Prevent NULL being valid */
120 KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
124 } .bss.textdata (NOLOAD) : AT ( _end_lma ) {
132 _textdata_filesz = ABSOLUTE ( _mtextdata ) - ABSOLUTE ( _textdata );
133 _textdata_memsz = ABSOLUTE ( _etextdata ) - ABSOLUTE ( _textdata );
138 * If present, this will be placed between .text16.early and .text16.late.
141 .pprefix 0x0 : AT ( _pprefix_lma ) {
146 } .bss.pprefix (NOLOAD) : AT ( _end_lma ) {
149 _pprefix_filesz = ABSOLUTE ( _mpprefix ) - ABSOLUTE ( _pprefix );
150 _pprefix_memsz = ABSOLUTE ( _epprefix ) - ABSOLUTE ( _pprefix );
153 * Compressor information block
157 .zinfo 0x0 : AT ( _zinfo_lma ) {
162 } .bss.zinfo (NOLOAD) : AT ( _end_lma ) {
165 _zinfo_filesz = ABSOLUTE ( _mzinfo ) - ABSOLUTE ( _zinfo );
166 _zinfo_memsz = ABSOLUTE ( _ezinfo ) - ABSOLUTE ( _zinfo );
169 * Weak symbols that need zero values if not otherwise defined
173 .weak 0x0 : AT ( _end_lma ) {
179 _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
182 * Dispose of the comment and note sections to make the link map
203 * Load address calculations. In older versions of ld, ALIGN()
204 * can operate only on the location counter, so we use that.
210 . = ALIGN ( _max_align );
214 . = ALIGN ( _max_align );
215 _text16_early_lma = .;
216 . += _text16_early_filesz;
218 . = ALIGN ( _max_align );
219 . = ALIGN ( _payload_align );
221 . += _pprefix_filesz;
223 . = ALIGN ( _max_align );
225 _pprefix_skip = ABSOLUTE ( _payload_lma ) - ABSOLUTE ( _pprefix_lma );
226 _text16_late_lma = .;
227 . += _text16_late_filesz;
229 . = ALIGN ( _max_align );
233 . = ALIGN ( _max_align );
235 . += _textdata_filesz;
237 _filesz = .; /* Do not include zinfo block in file size */
239 . = ALIGN ( _max_align );
243 . = ALIGN ( _max_align );
247 * Values calculated to save code from doing it
250 _text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
251 _data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );
252 _textdata_memsz_pgh = ( ( _textdata_memsz + 15 ) / 16 );
253 _textdata_memsz_kb = ( ( _textdata_memsz + 1023 ) / 1024 );