forked from rh-hideout/pokeemerald-expansion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ld_script_modern.ld
165 lines (142 loc) · 3.81 KB
/
ld_script_modern.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
ENTRY(Start)
gNumMusicPlayers = 4;
gMaxLines = 0;
gInitialMainCB2 = CB2_InitCopyrightScreenAfterBootup;
MEMORY
{
EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K
IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M
}
SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4)
{
/*
We link malloc.o here to prevent `gHeap` from landing in the middle of EWRAM.
Otherwise this causes corruption issues on some ld versions
*/
gflib/malloc.o(ewram_data);
src/*.o(ewram_data);
gflib/*.o(ewram_data);
} > EWRAM
iwram 0x3000000 (NOLOAD) :
ALIGN(4)
{
src/*.o(.bss);
gflib/*.o(.bss);
data/*.o(.bss);
*libc.a:*.o(.bss*);
*libnosys.a:*.o(.bss*);
src/m4a.o(.bss.code);
src/*.o(COMMON);
gflib/*.o(COMMON);
*libc.a:*.o(COMMON);
*libnosys.a:*.o(COMMON);
} > IWRAM
/* BEGIN ROM DATA */
. = 0x8000000;
.text :
ALIGN(4)
{
src/rom_header.o(.text*);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
src/crt0.o(.text);
src/main.o(.text);
gflib/*.o(.text*);
src/*.o(.text*);
asm/*.o(.text*);
} > ROM =0
script_data :
ALIGN(4)
{
data/*.o(script_data);
} > ROM =0
lib_text :
ALIGN(4)
{
src/libgcnmultiboot.o(.text);
src/m4a_1.o(.text);
src/m4a.o(.text);
src/agb_flash.o(.text);
src/agb_flash_1m.o(.text);
src/agb_flash_mx.o(.text);
src/siirtc.o(.text);
src/librfu_stwi.o(.text);
src/librfu_intr.o(.text);
src/librfu_rfu.o(.text);
src/librfu_sio32id.o(.text);
*libagbsyscall.a:*.o(.text*);
*libgcc.a:*.o(.text*);
*libc.a:*.o(.text*);
*libnosys.a:*.o(.text*);
src/libisagbprn.o(.text);
} > ROM =0
.rodata :
ALIGN(4)
{
src/*.o(.rodata*);
gflib/*.o(.rodata*);
data/*.o(.rodata*);
} > ROM =0
song_data :
ALIGN(4)
{
sound/songs/*.o(.rodata);
} > ROM =0
lib_rodata :
SUBALIGN(4)
{
src/m4a.o(.rodata);
src/agb_flash.o(.rodata);
src/agb_flash_1m.o(.rodata);
src/agb_flash_mx.o(.rodata);
src/agb_flash_le.o(.rodata);
src/siirtc.o(.rodata);
src/librfu_rfu.o(.rodata);
src/librfu_sio32id.o(.rodata);
*libgcc.a:*.o(.rodata*);
*libc.a:*.o(.rodata*);
*libc.a:*.o(.data*);
src/libisagbprn.o(.rodata);
} > ROM =0
multiboot_data :
ALIGN(4)
{
data/multiboot_ereader.o(.rodata);
data/multiboot_berry_glitch_fix.o(.rodata);
data/multiboot_pokemon_colosseum.o(.rodata);
} > ROM =0
gfx_data :
ALIGN(4)
{
src/graphics.o(.rodata);
} > ROM =0
__rom_end = .;
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* Discard everything not specifically mentioned above. */
/DISCARD/ :
{
*(*);
}
}