-
Notifications
You must be signed in to change notification settings - Fork 10
/
link.ld
106 lines (85 loc) · 2.02 KB
/
link.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
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
OUTPUT_FORMAT(elf64-littleaarch64)
OUTPUT_ARCH(aarch64)
ENTRY(_start)
PHDRS
{
text PT_LOAD FLAGS(5);
rodata PT_LOAD FLAGS(4);
data PT_LOAD FLAGS(6);
bss PT_LOAD FLAGS(6);
dynamic PT_DYNAMIC;
}
SECTIONS
{
. = 0;
.text : ALIGN(0x1000) {
HIDDEN(__text_start = .);
*(.nro_header)
KEEP(*(.text.jmp))
. = 0x80;
*(.text .text.*)
*(.plt .plt.*)
HIDDEN(__text_end = .);
} :text
/* Read-only sections */
. = ALIGN(0x1000);
.module_name : { KEEP (*(.rodata.module_name)) } :rodata
.hooks : {
__hook_array_start = .;
*(.rodata.hooks)
__hook_array_end = .;
} :rodata
.rodata : {
*(.rodata .rodata.*)
} :rodata
.mod0 : {
KEEP(crt0.nso.o(.data.mod0))
KEEP(crt0.nro.o(.data.mod0))
KEEP(crt0.lib.nro.o(.data.mod0))
}
.hash : { *(.hash) }
.dynsym : { *(.dynsym .dynsym.*) }
.dynstr : { *(.dynstr .dynstr.*) }
.rela.dyn : { *(.rela.dyn) }
.eh_frame : ONLY_IF_RO {
HIDDEN(__eh_frame_start = .);
KEEP (*(.eh_frame)) *(.eh_frame.*)
HIDDEN(__eh_frame_end = .);
}
.eh_frame_hdr : {
HIDDEN(__eh_frame_hdr_start = .);
*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*)
HIDDEN(__eh_frame_hdr_end = .);
}
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
.gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
/* Read-write sections */
. = ALIGN(0x1000);
.data : {
*(.data .data.*)
*(.got .got.*)
*(.got.plt .got.plt.*)
} :data
.eh_frame : ONLY_IF_RW {
HIDDEN(__eh_frame_start = .);
KEEP (*(.eh_frame)) *(.eh_frame.*)
HIDDEN(__eh_frame_end = .);
}
.gnu_extab : ONLY_IF_RW { *(.gnu_extab*) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
.dynamic : {
HIDDEN(__dynamic_start = .);
*(.dynamic)
}
/* BSS section */
. = ALIGN(0x1000);
.bss : {
HIDDEN(__bss_start = .);
*(.bss .bss.*)
*(COMMON)
HIDDEN(__nx_module_runtime = .);
*(.bss.module_runtime)
. = ALIGN(8);
HIDDEN(__bss_end = .);
} :bss
}