1 | /* Example Linker Script for linking NS CRX elf32 files. */ |
---|
2 | OUTPUT_FORMAT("elf32-crx") |
---|
3 | OUTPUT_ARCH(crx) |
---|
4 | |
---|
5 | /* |
---|
6 | The libh.a library includes various CR default handlers. |
---|
7 | The libsim.a library includes low-level functions, which |
---|
8 | are used as an interface to communicate with the simulator. |
---|
9 | */ |
---|
10 | GROUP(-lc -lsim -lh -lgcc) |
---|
11 | |
---|
12 | /* |
---|
13 | The next line forces the entry point (_start in this script) |
---|
14 | to be entered in the output file as an undefined symbol. |
---|
15 | It is needed in case the entry point is not called explicitly |
---|
16 | (which is the usual case) AND is in an archive. |
---|
17 | */ |
---|
18 | EXTERN(_start) |
---|
19 | ENTRY(_start) |
---|
20 | |
---|
21 | /* Define memory regions */ |
---|
22 | MEMORY |
---|
23 | { |
---|
24 | rom : ORIGIN = 0x2, LENGTH = 3M |
---|
25 | ram : ORIGIN = 4M, LENGTH = 10M |
---|
26 | } |
---|
27 | |
---|
28 | SECTIONS |
---|
29 | { |
---|
30 | .init : |
---|
31 | { |
---|
32 | __INIT_START = .; |
---|
33 | KEEP (*(.init)) |
---|
34 | __INIT_END = .; |
---|
35 | } > rom |
---|
36 | |
---|
37 | .fini : |
---|
38 | { |
---|
39 | __FINI_START = .; |
---|
40 | KEEP (*(.fini)) |
---|
41 | __FINI_END = .; |
---|
42 | } > rom |
---|
43 | |
---|
44 | .jcr : |
---|
45 | { |
---|
46 | KEEP (*(.jcr)) |
---|
47 | } > rom |
---|
48 | |
---|
49 | .text : |
---|
50 | { |
---|
51 | __TEXT_START = .; |
---|
52 | *(.text) *(.text.*) *(.gnu.linkonce.t.*) |
---|
53 | __TEXT_END = .; |
---|
54 | } > rom |
---|
55 | |
---|
56 | .rdata : |
---|
57 | { |
---|
58 | __RDATA_START = .; |
---|
59 | *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) |
---|
60 | __RDATA_END = .; |
---|
61 | } > rom |
---|
62 | |
---|
63 | .ctor ALIGN(4) : |
---|
64 | { |
---|
65 | __CTOR_START = .; |
---|
66 | KEEP (*crtbegin*.o(.ctors)) |
---|
67 | KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) |
---|
68 | KEEP (*(SORT(.ctors.*))) |
---|
69 | KEEP (*(.ctors)) |
---|
70 | __CTOR_END = .; |
---|
71 | } > rom |
---|
72 | |
---|
73 | .dtor ALIGN(4) : |
---|
74 | { |
---|
75 | __DTOR_START = .; |
---|
76 | KEEP (*crtbegin*.o(.dtors)) |
---|
77 | KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) |
---|
78 | KEEP (*(SORT(.dtors.*))) |
---|
79 | KEEP (*(.dtors)) |
---|
80 | __DTOR_END = .; |
---|
81 | } > rom |
---|
82 | |
---|
83 | .data : |
---|
84 | { |
---|
85 | __DATA_START = .; |
---|
86 | *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*) |
---|
87 | __DATA_END = .; |
---|
88 | } > ram AT > rom |
---|
89 | |
---|
90 | .bss (NOLOAD) : |
---|
91 | { |
---|
92 | __BSS_START = .; |
---|
93 | *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*) |
---|
94 | __BSS_END = .; |
---|
95 | } > ram |
---|
96 | |
---|
97 | /* |
---|
98 | You may change the sizes of the following sections to fit the actual |
---|
99 | size your program requires. |
---|
100 | The heap and stack are aligned to the bus width, as a speed optimization |
---|
101 | for accessing data located there. |
---|
102 | */ |
---|
103 | .heap : |
---|
104 | { |
---|
105 | . = ALIGN(4); |
---|
106 | __HEAP_START = .; |
---|
107 | . += 0x2000; |
---|
108 | __HEAP_MAX = .; |
---|
109 | } > ram |
---|
110 | |
---|
111 | .stack : |
---|
112 | { |
---|
113 | . = ALIGN(4); |
---|
114 | . += 0x6000; |
---|
115 | __STACK_START = .; |
---|
116 | } > ram |
---|
117 | |
---|
118 | .istack : |
---|
119 | { |
---|
120 | . = ALIGN(4); |
---|
121 | . += 0x100; |
---|
122 | __ISTACK_START = .; |
---|
123 | } > ram |
---|
124 | } |
---|
125 | |
---|
126 | __DATA_IMAGE_START = LOADADDR(.data); |
---|