-
Notifications
You must be signed in to change notification settings - Fork 0
/
linkfile.ld
138 lines (116 loc) · 2.75 KB
/
linkfile.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
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
/* This file is part of Racdoor.
Copyright (c) 2024 chaoticgd. All rights reversed.
Released under the BSD-1-Clause license. */
ENTRY(loader);
PHDRS
{
text PT_LOAD;
}
SECTIONS
{
. = 0x0;
/* This is a fake section used to hold all the symbols used for linking with
the game. It must have an address of zero so that the linker doesn't try
to relocate any of them since they already have absolute addresses. */
.racdoor.dummy :
{
*(.racdoor.dummy)
}
/* This is a good spot for a code cave. It's low enough that it's not used
by the game, but is also high enough that in practice it's not used by
the operating system or OPL. */
. = 0x000d0000;
/* Assembly code that loads the other sections by copying, filling or
decompressing them. */
.racdoor.loader :
{
/* EE hardware errata: Prevent code and data from being too close. */
. += 0x14;
*(.racdoor.loader)
} :text
.text :
{
*(.text)
*(.text.*)
*(.gnu.linkonce.t*)
/* Function hooks that are installed automatically. */
. = ALIGN(8);
_racdoor_autohooks = .;
*(.racdoor.autohooks)
_racdoor_autohooks_end = .;
/* EE hardware errata: Prevent code and data from being too close. */
. += 0x14;
}
.data ALIGN(128) :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
}
.rodata ALIGN(128) :
{
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r*)
}
.sdata ALIGN(128) :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s*)
}
.sbss ALIGN(128) :
{
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb*)
*(.scommon)
}
.bss ALIGN(128) :
{
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b*)
*(COMMON)
}
/* Function pointers used for loading, updating and unloading modules. */
.racdoor.modules :
{
_racdoor_modloadfuncs = .;
*(.racdoor.modloadfuncs)
_racdoor_modloadfuncs_end = .;
_racdoor_modupdatefuncs = .;
*(.racdoor.modupdatefuncs)
_racdoor_modupdatefuncs_end = .;
_racdoor_modunloadfuncs = .;
*(.racdoor.modunloadfuncs)
_racdoor_modunloadfuncs_end = .;
}
/* Level to overlay index mapping table. Cannot be compressed since it is
used by the loader. */
.racdoor.overlaymap :
{
_racdoor_overlaymap = .;
*(.racdoor.overlaymap)
}
/* Runtime address table used for performing relocation. */
.racdoor.addrtbl :
{
_racdoor_addrtbl = .;
*(.racdoor.addrtbl)
}
/* Array of function pointers for the FastDecompress function, one element
for each overlay. Cannot be compressed since it is used by the loader. */
.racdoor.fastdecompress :
{
_racdoor_fastdecompress = .;
*(.racdoor.fastdecompress)
}
/* Runtime relocation table. This is filled in by rdxlink and only contains
relocations that are needed for linking against the level overlays. */
.racdoor.relocs :
{
_racdoor_relocs = .;
*(.racdoor.relocs)
}
}