-
Notifications
You must be signed in to change notification settings - Fork 89
/
link.x
86 lines (71 loc) · 1.7 KB
/
link.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
SECTIONS
{
# Combine text, rodata, and eh_frame stuff
# In case you'll ever need to get the base address of eboot.bin, you can use the &__text_start symbol.
# No need to go through libkernel for that.
.text : ALIGN(0x4000) {
__text_start = .;
# "/libexec/ld-elf.so.1"
QUAD(0x6365786562696C2F);
QUAD(0x2E666C652D646C2F);
QUAD(0x00000000312E6F73);
QUAD(0x0000000000000000);
# original .text
*(.text .text.*)
}
.rodata : ALIGN(0x10) {
*(.rodata .rodata.*)
}
# Since we lack a proper POSIX dladdr() on a PS4, we define these global symbols
# For libunwind's bare metal compilation mode.
# That's way better than going through libkernel... ;-;
.eh_frame : {
__eh_frame_start = .;
KEEP(*(.eh_frame))
__eh_frame_end = .;
}
.eh_frame_hdr : {
__eh_frame_hdr_start = .;
KEEP(*(.eh_frame_hdr))
__eh_frame_hdr_end = .;
}
.data.rel.ro : ALIGN(0x4000) {
__data_relro_start = .;
KEEP(*(.data.rel.ro .data.rel.ro.*))
__data_relro_start = .;
}
.init_array : {
*(.init_array);
}
.dynamic : {
*(.dynamic);
}
.tls : {
*(.tdata);
*(.tbss);
}
# Align .got to 0x4000 if .data.rel.ro doesn't exist
.got : ALIGN(SIZEOF(.data.rel.ro) > 0 ? 8 : 0x4000) {
*(.got)
}
# Align .got.plt to 0x4000 if .got doesn't exist
.got.plt : ALIGN((SIZEOF(.got) > 0 || SIZEOF(.data.rel.ro) > 0) ? 8 : 0x4000) {
*(.got.plt)
}
.data.sce_process_param : ALIGN(0x4000) {
KEEP(*(.data.sce_process_param))
}
.data.sce_module_param : ALIGN(0x4000) {
KEEP(*(.data.sce_module_param))
}
.data : {
*(.data)
}
.bss : {
*(.bss .bss.*)
}
# Force .got.plt to appear, because SPRX requires a valid .got.plt.
/DISCARD/ : {
QUAD(_GLOBAL_OFFSET_TABLE_)
}
}