forked from astrelsky/libhijacker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linker.x
100 lines (78 loc) · 1.22 KB
/
linker.x
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
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
PHDRS
{
/*
* PF_X = 0x1
* PF_W = 0x2
* PF_R = 0x4
*/
ph_text PT_LOAD FLAGS (0x1 | 0x4);
ph_relro PT_LOAD FLAGS (0x4);
ph_data PT_LOAD FLAGS (0x2 | 0x4);
ph_dyn PT_DYNAMIC FLAGS(0x2 | 0x4);
}
SECTIONS
{
__payload_base = .;
.text : ALIGN(0x4000)
{
PROVIDE_HIDDEN(__text_start = .);
KEEP (*(.init))
KEEP (*(.fini))
*(.text .text.*)
PROVIDE_HIDDEN(__text_stop = .);
} : ph_text = 0x90909090
.rodata : ALIGN(0x4000)
{
*(.rodata .rodata.*)
}
.eh_frame : ALIGN(0x4000)
{
*(.eh_frame.*)
}
. = ALIGN(0x4000);
.data.rel.ro : ALIGN(0x4000)
{
*(.data.rel.ro .data.rel.ro.*)
} : ph_relro
.rela :
{
*(.rela *.rela.*)
}
. = ALIGN(0x4000);
.data : ALIGN(0x4000)
{
*(.data .data.*)
. = ALIGN(0x10);
__imports_start = .;
KEEP(*(.imports .imports.*))
__imports_end = .;
__patches_start = .;
KEEP(*(.patches .patches.*))
QUAD(0); BYTE(0); BYTE(0);
__patches_end = .;
__bss_start = .;
*(.bss .bss.*) *(COMMON)
__bss_end = .;
. = . + 4;
. = ALIGN(4);
} : ph_data
.dynamic :
{
*(.dynamic)
} : ph_dyn
.dynstr :
{
*(.dynstr)
}
.dynsym :
{
*(.dynsym)
}
.rela.dyn :
{
*(.rela.dyn)
}
}