|
@@ -27,10 +27,18 @@ SECTIONS {
|
27
|
27
|
PROVIDE ( _max_align = 16 );
|
28
|
28
|
|
29
|
29
|
/*
|
30
|
|
- * Default to not generating space for page tables
|
|
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.
|
31
|
35
|
*
|
32
|
36
|
*/
|
33
|
|
- PROVIDE ( _use_page_tables = 0 );
|
|
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 );
|
34
|
42
|
|
35
|
43
|
/*
|
36
|
44
|
* Allow decompressor to require a minimum amount of temporary stack
|
|
@@ -133,12 +141,18 @@ SECTIONS {
|
133
|
141
|
*(COMMON)
|
134
|
142
|
*(.stack)
|
135
|
143
|
*(.stack.*)
|
|
144
|
+ _pages = .;
|
136
|
145
|
*(.pages)
|
137
|
146
|
*(.pages.*)
|
138
|
|
- _textdata_paged_len = ABSOLUTE ( . - _textdata );
|
139
|
|
- _textdata_ptes = ABSOLUTE ( ( _textdata_paged_len + 4095 ) / 4096 );
|
140
|
|
- _textdata_pdes = ABSOLUTE ( ( _textdata_ptes + 511 ) / 512 );
|
141
|
|
- . += ( _use_page_tables ? ( _textdata_pdes * 4096 ) : 0 );
|
|
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 = .;
|
142
|
156
|
_etextdata = .;
|
143
|
157
|
}
|
144
|
158
|
_textdata_filesz = ABSOLUTE ( _mtextdata ) - ABSOLUTE ( _textdata );
|