OLD | NEW |
---|---|
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 * | 4 * |
5 * This is a custom linker script used to build nacl_helper_bootstrap. | 5 * This is a custom linker script used to build nacl_helper_bootstrap. |
6 * It has a very special layout. This script will only work with input | 6 * It has a very special layout. This script will only work with input |
7 * that is kept extremely minimal. If there are unexpected input sections | 7 * that is kept extremely minimal. If there are unexpected input sections |
8 * not named here, the result will not be correct. | 8 * not named here, the result will not be correct. |
9 * | 9 * |
10 * We need to use a standalone loader program rather than just using a | 10 * We need to use a standalone loader program rather than just using a |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 /* | 42 /* |
43 * We specify the program headers we want explicitly, to get the layout | 43 * We specify the program headers we want explicitly, to get the layout |
44 * exactly right and to give the "reserve" segment p_flags of zero, so | 44 * exactly right and to give the "reserve" segment p_flags of zero, so |
45 * that it gets mapped as PROT_NONE. | 45 * that it gets mapped as PROT_NONE. |
46 */ | 46 */ |
47 PHDRS { | 47 PHDRS { |
48 text PT_LOAD FILEHDR PHDRS; | 48 text PT_LOAD FILEHDR PHDRS; |
49 data PT_LOAD; | 49 data PT_LOAD; |
50 reserve PT_LOAD FLAGS(0); | 50 reserve PT_LOAD FLAGS(0); |
51 r_debug PT_LOAD; | |
Mark Seaborn
2011/11/14 20:15:41
Should you put FLAGS? What's the default? It doe
| |
51 note PT_NOTE; | 52 note PT_NOTE; |
52 stack PT_GNU_STACK FLAGS(6); /* RW, no E */ | 53 stack PT_GNU_STACK FLAGS(6); /* RW, no E */ |
53 } | 54 } |
54 | 55 |
55 /* | 56 /* |
56 * Now we lay out the sections across those segments. | 57 * Now we lay out the sections across those segments. |
57 */ | 58 */ |
58 SECTIONS { | 59 SECTIONS { |
59 . = TEXT_START + SIZEOF_HEADERS; | 60 . = TEXT_START + SIZEOF_HEADERS; |
60 | 61 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 * It just maps it from the file, i.e. way off the end of the file, | 106 * It just maps it from the file, i.e. way off the end of the file, |
106 * which is perfect for reserving the address space. | 107 * which is perfect for reserving the address space. |
107 */ | 108 */ |
108 . = ALIGN(CONSTANT(COMMONPAGESIZE)); | 109 . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
109 RESERVE_START = .; | 110 RESERVE_START = .; |
110 .reserve : { | 111 .reserve : { |
111 . = RESERVE_TOP - RESERVE_START; | 112 . = RESERVE_TOP - RESERVE_START; |
112 } :reserve | 113 } :reserve |
113 | 114 |
114 /* | 115 /* |
116 * This must be placed above the reserved address space, so it won't | |
117 * be clobbered by NaCl. We want this to be visible at its fixed address | |
118 * in the memory image so the debugger can make sense of things. | |
119 */ | |
120 .r_debug : { | |
121 *(.r_debug) | |
122 } :r_debug | |
123 | |
124 /* | |
115 * These are empty input sections the linker generates. | 125 * These are empty input sections the linker generates. |
116 * If we don't discard them, they pollute the flags in the output segment. | 126 * If we don't discard them, they pollute the flags in the output segment. |
117 */ | 127 */ |
118 /DISCARD/ : { | 128 /DISCARD/ : { |
119 *(.iplt) | 129 *(.iplt) |
120 *(.rel*) | 130 *(.rel*) |
121 *(.igot.plt) | 131 *(.igot.plt) |
122 } | 132 } |
123 } | 133 } |
OLD | NEW |