~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/arch/x86/scripts/pcbios.lds

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- ld-script -*- */
 
2
 
 
3
/*
 
4
 * Linker script for i386 images
 
5
 *
 
6
 */
 
7
 
 
8
SECTIONS {
 
9
 
 
10
    /* Each section starts at a virtual address of zero.
 
11
     *
 
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.
 
18
     *
 
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).
 
24
     *
 
25
     */
 
26
 
 
27
    PROVIDE ( _max_align = 16 );
 
28
 
 
29
    /*
 
30
     * Values used in page table calculations
 
31
     *
 
32
     * On older versions of ld (without the SANE_EXPR feature),
 
33
     * numeric literals within a section description tend to be
 
34
     * interpreted as section-relative symbols.
 
35
     *
 
36
     */
 
37
    _page_size = 4096;
 
38
    _page_size_1 = ( _page_size - 1 );
 
39
    _pte_size = 8;
 
40
    _pte_count = ( _page_size / _pte_size );
 
41
    _pte_count_1 = ( _pte_count - 1 );
 
42
 
 
43
    /*
 
44
     * Allow decompressor to require a minimum amount of temporary stack
 
45
     * space.
 
46
     *
 
47
     */
 
48
    PROVIDE ( _min_decompress_stack = 0 );
 
49
 
 
50
    /*
 
51
     * The prefix
 
52
     *
 
53
     */
 
54
 
 
55
    .prefix 0x0 : AT ( _prefix_lma ) {
 
56
        _prefix = .;
 
57
        *(.prefix)
 
58
        *(SORT(.pci_devlist.*))
 
59
        *(.prefix.*)
 
60
        _mprefix = .;
 
61
    } .bss.prefix (NOLOAD) : AT ( _end_lma ) {
 
62
        _eprefix = .;
 
63
    }
 
64
    _prefix_filesz      = ABSOLUTE ( _mprefix ) - ABSOLUTE ( _prefix );
 
65
    _prefix_memsz       = ABSOLUTE ( _eprefix ) - ABSOLUTE ( _prefix );
 
66
 
 
67
    /*
 
68
     * The 16-bit (real-mode) code section
 
69
     *
 
70
     */
 
71
 
 
72
    .text16.early 0x0 : AT ( _text16_early_lma ) {
 
73
        _text16 = .;
 
74
        KEEP(*(.text16.null))
 
75
        KEEP(*(.text16.null.*))
 
76
        . += 1;                         /* Prevent NULL being valid */
 
77
        *(.text16.early)
 
78
        *(.text16.early.*)
 
79
        _etext16_early = .;
 
80
    } .text16.late ALIGN ( _max_align ) : AT ( _text16_late_lma ) {
 
81
        _text16_late = .;
 
82
        *(.text16)
 
83
        *(.text16.*)
 
84
        _mtext16 = .;
 
85
    } .bss.text16 (NOLOAD) : AT ( _end_lma ) {
 
86
        _etext16 = .;
 
87
    }
 
88
    _text16_early_filesz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 );
 
89
    _text16_early_memsz = ABSOLUTE ( _etext16_early ) - ABSOLUTE ( _text16 );
 
90
    _text16_late_filesz = ABSOLUTE ( _mtext16 ) - ABSOLUTE ( _text16_late );
 
91
    _text16_late_memsz  = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16_late );
 
92
    _text16_memsz       = ABSOLUTE ( _etext16 ) - ABSOLUTE ( _text16 );
 
93
 
 
94
    /*
 
95
     * The 16-bit (real-mode) data section
 
96
     *
 
97
     */
 
98
 
 
99
    .data16 0x0 : AT ( _data16_lma ) {
 
100
        _data16 = .;
 
101
        . += 1;                         /* Prevent NULL being valid */
 
102
        *(.rodata16)
 
103
        *(.rodata16.*)
 
104
        *(.data16)
 
105
        *(.data16.*)
 
106
        _mdata16 = .;
 
107
    } .bss.data16 (NOLOAD) : AT ( _end_lma ) {
 
108
        *(.bss16)
 
109
        *(.bss16.*)
 
110
        *(.stack16)
 
111
        *(.stack16.*)
 
112
        . = MAX ( ., _mdata16 + _min_decompress_stack );
 
113
        _edata16 = .;
 
114
    }
 
115
    _data16_filesz      = ABSOLUTE ( _mdata16 ) - ABSOLUTE ( _data16 );
 
116
    _data16_memsz       = ABSOLUTE ( _edata16 ) - ABSOLUTE ( _data16 );
 
117
 
 
118
    /*
 
119
     * The 32-bit sections
 
120
     *
 
121
     */
 
122
 
 
123
    .textdata 0x0 : AT ( _textdata_lma ) {
 
124
        _textdata = .;
 
125
        KEEP(*(.text.null_trap))
 
126
        KEEP(*(.text.null_trap.*))
 
127
        . += 1;                         /* Prevent NULL being valid */
 
128
        *(.text)
 
129
        *(.text.*)
 
130
        *(.rodata)
 
131
        *(.rodata.*)
 
132
        *(.data)
 
133
        *(.data.*)
 
134
        KEEP(*(SORT(.tbl.*)))   /* Various tables.  See include/tables.h */
 
135
        KEEP(*(.provided))
 
136
        KEEP(*(.provided.*))
 
137
        _mtextdata = .;
 
138
    } .bss.textdata (NOLOAD) : AT ( _end_lma ) {
 
139
        *(.bss)
 
140
        *(.bss.*)
 
141
        *(COMMON)
 
142
        *(.stack)
 
143
        *(.stack.*)
 
144
        _pages = .;
 
145
        *(.pages)
 
146
        *(.pages.*)
 
147
        _use_page_tables = ABSOLUTE ( . ) - ABSOLUTE ( _pages );
 
148
        _textdata_paged_len =
 
149
            ABSOLUTE ( ABSOLUTE ( . ) - ABSOLUTE ( _textdata ) );
 
150
        _textdata_ptes =
 
151
            ABSOLUTE ( ( _textdata_paged_len + _page_size_1 ) / _page_size );
 
152
        _textdata_pdes =
 
153
            ABSOLUTE ( ( _textdata_ptes + _pte_count_1 ) / _pte_count );
 
154
        . += ( _use_page_tables ? ( _textdata_pdes * _page_size ) : 0 );
 
155
        _epages = .;
 
156
        _etextdata = .;
 
157
    }
 
158
    _textdata_filesz    = ABSOLUTE ( _mtextdata ) - ABSOLUTE ( _textdata );
 
159
    _textdata_memsz     = ABSOLUTE ( _etextdata ) - ABSOLUTE ( _textdata );
 
160
 
 
161
    /*
 
162
     * Payload prefix
 
163
     *
 
164
     * If present, this will be placed between .text16.early and .text16.late.
 
165
     *
 
166
     */
 
167
    .pprefix 0x0 : AT ( _pprefix_lma ) {
 
168
        _pprefix = .;
 
169
        KEEP(*(.pprefix))
 
170
        KEEP(*(.pprefix.*))
 
171
        _mpprefix = .;
 
172
    } .bss.pprefix (NOLOAD) : AT ( _end_lma ) {
 
173
        _epprefix = .;
 
174
    }
 
175
    _pprefix_filesz     = ABSOLUTE ( _mpprefix ) - ABSOLUTE ( _pprefix );
 
176
    _pprefix_memsz      = ABSOLUTE ( _epprefix ) - ABSOLUTE ( _pprefix );
 
177
 
 
178
    /*
 
179
     * Compressor information block
 
180
     *
 
181
     */
 
182
 
 
183
    .zinfo 0x0 : AT ( _zinfo_lma ) {
 
184
        _zinfo = .;
 
185
        KEEP(*(.zinfo))
 
186
        KEEP(*(.zinfo.*))
 
187
        _mzinfo = .;
 
188
    } .bss.zinfo (NOLOAD) : AT ( _end_lma ) {
 
189
        _ezinfo = .;
 
190
    }
 
191
    _zinfo_filesz       = ABSOLUTE ( _mzinfo ) - ABSOLUTE ( _zinfo );
 
192
    _zinfo_memsz        = ABSOLUTE ( _ezinfo ) - ABSOLUTE ( _zinfo );
 
193
 
 
194
    /*
 
195
     * Weak symbols that need zero values if not otherwise defined
 
196
     *
 
197
     */
 
198
 
 
199
    .weak 0x0 : AT ( _end_lma ) {
 
200
        _weak = .;
 
201
        *(.weak)
 
202
        *(.weak.*)
 
203
        _eweak = .;
 
204
    }
 
205
    _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
 
206
 
 
207
    /*
 
208
     * Dispose of the comment and note sections to make the link map
 
209
     * easier to read
 
210
     *
 
211
     */
 
212
 
 
213
    /DISCARD/ : {
 
214
        *(.comment)
 
215
        *(.comment.*)
 
216
        *(.note)
 
217
        *(.note.*)
 
218
        *(.eh_frame)
 
219
        *(.eh_frame.*)
 
220
        *(.rel)
 
221
        *(.rel.*)
 
222
        *(.einfo)
 
223
        *(.einfo.*)
 
224
        *(.discard)
 
225
        *(.discard.*)
 
226
    }
 
227
 
 
228
    /*
 
229
     * Load address calculations.  In older versions of ld, ALIGN()
 
230
     * can operate only on the location counter, so we use that.
 
231
     *
 
232
     */
 
233
 
 
234
    .                   = 0;
 
235
 
 
236
    .                   = ALIGN ( _max_align );
 
237
    _prefix_lma         = .;
 
238
    .                   += _prefix_filesz;
 
239
 
 
240
    .                   = ALIGN ( _max_align );
 
241
    _text16_early_lma   = .;
 
242
    .                   += _text16_early_filesz;
 
243
 
 
244
    .                   = ALIGN ( _max_align );
 
245
    .                   = ALIGN ( _payload_align );
 
246
    _pprefix_lma        = .;
 
247
    .                   += _pprefix_filesz;
 
248
 
 
249
    .                   = ALIGN ( _max_align );
 
250
    _payload_lma        = .;
 
251
    _pprefix_skip       = ABSOLUTE ( _payload_lma ) - ABSOLUTE ( _pprefix_lma );
 
252
    _text16_late_lma    = .;
 
253
    .                   += _text16_late_filesz;
 
254
 
 
255
    .                   = ALIGN ( _max_align );
 
256
    _data16_lma         = .;
 
257
    .                   += _data16_filesz;
 
258
 
 
259
    .                   = ALIGN ( _max_align );
 
260
    _textdata_lma       = .;
 
261
    .                   += _textdata_filesz;
 
262
 
 
263
    _filesz             = .; /* Do not include zinfo block in file size */
 
264
 
 
265
    .                   = ALIGN ( _max_align );
 
266
    _zinfo_lma          = .;
 
267
    .                   += _zinfo_filesz;
 
268
 
 
269
    .                   = ALIGN ( _max_align );
 
270
    _end_lma            = .;
 
271
 
 
272
    /*
 
273
     * Values calculated to save code from doing it
 
274
     *
 
275
     */
 
276
    _text16_memsz_ppgh  = ( ( ( _text16_memsz + 63 ) / 64 ) * 4 );
 
277
    _data16_memsz_ppgh  = ( ( ( _data16_memsz + 63 ) / 64 ) * 4 );
 
278
    _textdata_memsz_pgh = ( ( _textdata_memsz + 15 ) / 16 );
 
279
    _textdata_memsz_kb  = ( ( _textdata_memsz + 1023 ) / 1024 );
 
280
}