summaryrefslogtreecommitdiff
path: root/ld_script.txt
blob: d7f1135aa1a407e64112fbe1b2ce2c5ab498077e (plain)
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
/* Linker Script to build Pokemon Diamond */

#define BEGIN_SEG(name, addr) \
    _##name##SegmentStart = ADDR(.name); \
    _##name##SegmentRomStart = __romPos; \
    .name addr : AT(__romPos)

#define END_SEG(name) \
    _##name##SegmentEnd = ADDR(.name) + SIZEOF(.name); \
    _##name##SegmentRomEnd = __romPos + SIZEOF(.name); \
    _##name##SegmentSize = SIZEOF(.name); \
    __romPos += SIZEOF(.name);

SECTIONS {
    __romPos = 0;
    BEGIN_SEG(ARM7Overlay, 0)
    {
    }
    END_SEG(ARM7Overlay)

    BEGIN_SEG(header, 0x0)
    {
        build/asm/rom_header.o(.text);
        . = 0x4000;
    } =0
    END_SEG(header)

    BEGIN_SEG(arm9, 0x2000000)
    {
        build/asm/secure.o(.text);
        build/asm/entry.o(.text);
        build/asm/main.o(.text);
        build/src/sub_02000DF4.o(.text);
		build/asm/arm9_thumb.o(.text);
        build/asm/rom2.o(.text);
    }
    END_SEG(arm9)

    garbage :
    {
    	build/asm/unk_10b724.o(.text);
    }=0

    . = 0x10B800;__romPos = .;
    BEGIN_SEG(ARM9Overlay, 0)
    {
    	build/asm/arm9overlay.o(.text);
    }
    END_SEG(ARM9Overlay)

	. = 0x10C400;__romPos = .;
    BEGIN_SEG(rom3, 0) /* shrug */
    {
        build/asm/rom3.o(.text);
    }
    END_SEG(rom3)

	. = 0x30D000;__romPos = .;
    BEGIN_SEG(arm7, 0x02380000)
    {
    	build/asm/arm7_rom.o(.text);
    }
    END_SEG(arm7)

	. = 0x336400;__romPos = .;
    BEGIN_SEG(FileNameTable, 0)
    {
    	build/asm/filenametable.o(.text);
    }
    END_SEG(FileNameTable)

    . = 0x337A00;__romPos = .;
    BEGIN_SEG(FileAllocationTable, 0)
    {
    	build/asm/fat.o(.text);
    }
    END_SEG(FileAllocationTable)

    . = 0x338600;__romPos = .;
    BEGIN_SEG(Icon, __romPos)
    {
    	build/asm/icon.o(.text);
    	build/asm/title.o(.text);
    }
    END_SEG(Icon)

	. = 0x339000;__romPos = .;
	BEGIN_SEG(NARC, 0)
	{
		build/asm/narc.o(.text);
	}
	END_SEG(NARC)

	/DISCARD/ :
	{
		*(*);
	}
}