forked from UnmappedStack/SpecOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.ld
47 lines (42 loc) · 1.02 KB
/
linker.ld
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
OUTPUT_FORMAT(elf64-x86-64)
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
PHDRS
{
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ; /* Dynamic PHDR for relocations */
}
SECTIONS
{
. = 0xffffffff80000000;
readonly_start = .;
.text : {
*(.text .text.*)
} :text
nxe_enabled_start = .; /* For where it stops being allowed to execute. */
. += CONSTANT(MAXPAGESIZE);
.rodata : {
*(.rodata .rodata.*)
} :rodata
readonly_end = .;
. += CONSTANT(MAXPAGESIZE);
writeallowed_start = .;
.data : {
*(.data .data.*)
} :data
.dynamic : {
*(.dynamic)
} :data :dynamic
.bss : {
*(.bss .bss.*)
*(COMMON)
} :data
writeallowed_end = .;
nxe_enabled_end = .;
/DISCARD/ : {
*(.eh_frame)
*(.note .note.*)
}
}