-
Notifications
You must be signed in to change notification settings - Fork 141
/
solo5_muen.lds
160 lines (140 loc) · 3.8 KB
/
solo5_muen.lds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* Copyright (c) 2015-2019 Contributors as noted in the AUTHORS file
*
* This file is part of Solo5, a sandboxed execution environment.
*
* Permission to use, copy, modify, and/or distribute this software
* for any purpose with or without fee is hereby granted, provided
* that the above copyright notice and this permission notice appear
* in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This is the custom linker script for the Solo5 'muen' target.
*
* The script is tested to work with a minimal set of input sections. If there
* are unexpected input sections not named here, the result will probably not be
* correct.
*/
TEXT_START = 0x200000;
ENTRY(_start)
/*
* Program headers: In order to force the linker to place each of our NOTEs
* into a separate PT_NOTE header, we need to lay these out explicitly.
*/
PHDRS {
interp PT_INTERP;
text PT_LOAD FLAGS(5); /* No FILEHDR or PHDRS, force R/E only.
FLAGS values come from PF_x in elf.h */
rodata PT_LOAD;
data PT_LOAD;
tdata PT_LOAD FLAGS(4); /* RO: this have to be copied into each thread */
tbss PT_TLS FLAGS(0); /* no perm needed */
bss PT_LOAD;
note.not_openbsd PT_NOTE; /* Must come first. */
note.abi PT_NOTE;
note.manifest PT_NOTE;
}
/*
* Output sections.
*/
SECTIONS {
. = TEXT_START; /* No + SIZEOF_HEADERS */
/*
* :text: The following input sections are placed in the R/E :text segment.
*/
_stext = .;
.interp : {
*(.interp)
} :interp :text
.text :
{
*(.text)
*(.text.*)
} :text
. = ALIGN(CONSTANT(MAXPAGESIZE));
_etext = .;
/* Read-only data */
/* For Muen, the ABI and MFT NOTEs are read-only and can be in :rodata. */
.note.solo5.manifest :
{
*(.note.solo5.manifest*)
} :rodata :note.manifest
.note.solo5.abi :
{
*(.note.solo5.abi*)
} :rodata :note.abi
.note.solo5.not_openbsd :
{
*(.note.solo5.not_openbsd*)
} :rodata :note.not_openbsd
.rodata :
{
*(.rodata)
*(.rodata.*)
} :rodata
.eh_frame :
{
*(.eh_frame)
}
. = ALIGN(CONSTANT(MAXPAGESIZE));
_erodata = .;
/*
* :data: The following input sections are placed in the R/W :data segment.
*/
/* Read-write data (initialized) */
.got :
{
*(.got.plt)
*(.got)
} :data
.data :
{
*(.data)
*(.data.*)
}
. = ALIGN(CONSTANT(MAXPAGESIZE));
/*
* tdata and tbss have to be side by side to help the linker calculate the
* various __thread variables offsets.
*/
.tdata :
{
_stdata = .;
*(.tdata)
. = ALIGN(CONSTANT(MAXPAGESIZE));
} :tdata
/*
* _edata is the address of the end of the area to be copied with multiboot
* (virtio and xen)
*/
_edata = .;
/* Read-write data (uninitialized) */
.tbss :
{
*(.tbss)
} :tbss
.bss :
{
*(.bss)
*(COMMON)
} :bss
. = ALIGN(CONSTANT(MAXPAGESIZE));
_ebss = .;
_end = .;
/* We are not building a GNU executable, so discard any default NOTEs the
toolchain might generate to prevent any surprises in the final layout. */
/DISCARD/ : {
*(.note.gnu.*)
}
_ltdata = SIZEOF(.tdata);
_ltbss = SIZEOF(.tbss);
}