-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
md.ld
120 lines (105 loc) · 2.45 KB
/
md.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
OUTPUT_ARCH(m68k)
SEARCH_DIR(.)
/*GROUP(-lbcc -lc -lgcc)*/
__DYNAMIC = 0;
/*
* Setup the memory map of the SEGA Genesis.
* stack grows down from high memory.
*
* The memory map look like this:
* +--------------------+ <- low memory
* | .text |
* | _etext |
* | ctor list | the ctor and dtor lists are for
* | dtor list | C++ support
* +--------------------+
* . .
* . .
* . .
* +--------------------+ <- 0xE0FF0000
* | .data | initialized data goes here
* | _data |
* | _edata |
* +--------------------+
* | .bss |
* | _bstart | start of bss, cleared by crt0
* | _bend | start of heap, used by sbrk()
* +--------------------+
* . .
* . .
* . .
* | __stack | top of stack
* +--------------------+ <- 0xE1000000
*/
MEMORY
{
rom (rx) : ORIGIN = 0x00000000, LENGTH = 0xE0000000
ram : ORIGIN = 0xE0FF0000, LENGTH = 0x00010000
}
/*
* allocate the stack to be at the top of memory, since the stack
* grows down
*/
PROVIDE (__stack = 0xE1000000);
SECTIONS
{
.text 0x00000000:
{
KEEP(*(.text.keepboot)) *(.text.*) *(.text)
. = ALIGN(0x4);
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
__DTOR_END__ = .;
*(.rodata .rodata.*)
*(.gcc_except_table .gcc_except_table.*)
. = ALIGN(0x4);
__INIT_SECTION__ = . ;
*(.init)
SHORT (0x4E75) /* rts */
__FINI_SECTION__ = . ;
*(.fini)
SHORT (0x4E75) /* rts */
_etext = .;
*(.lit)
*(.rodata_bin)
*(.rodata_binf)
} > rom
_stext = SIZEOF (.text);
.data 0xE0FF0000 :
AT ( ADDR (.text) + SIZEOF (.text) )
{
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.*)
*(.ramprog .ramprog.*)
_edata = .;
} > ram
_sdata = SIZEOF (.data);
.bss 0xE0FF0000 + SIZEOF (.data) :
{
_start = . ;
*(.shbss)
*(.bss .bss.*)
*(COMMON)
_bend = . ;
} > ram
.stab 0 (NOLOAD) :
{
*(.stab)
}
.stabstr 0 (NOLOAD) :
{
*(.stabstr)
}
.eh_frame 0 (NOLOAD) :
{
*(.eh_frame)
}
}