1 | /* Example Linker Script for linking NS CR16 elf32 files.*/ |
---|
2 | OUTPUT_FORMAT("elf32-cr16") |
---|
3 | OUTPUT_ARCH(cr16) |
---|
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: Only RAM required for simulator */ |
---|
22 | MEMORY |
---|
23 | { |
---|
24 | ram : ORIGIN = 0x2, LENGTH = 10M |
---|
25 | } |
---|
26 | |
---|
27 | SECTIONS |
---|
28 | { |
---|
29 | .init : |
---|
30 | { |
---|
31 | __INIT_START = .; |
---|
32 | KEEP (*(.init)) |
---|
33 | __INIT_END = .; |
---|
34 | } > ram |
---|
35 | |
---|
36 | .fini : |
---|
37 | { |
---|
38 | __FINI_START = .; |
---|
39 | KEEP (*(.fini)) |
---|
40 | __FINI_END = .; |
---|
41 | } > ram |
---|
42 | |
---|
43 | .jcr : |
---|
44 | { |
---|
45 | KEEP (*(.jcr)) |
---|
46 | } > ram |
---|
47 | |
---|
48 | .text : |
---|
49 | { |
---|
50 | __TEXT_START = .; |
---|
51 | *(.text) *(.text.*) *(.gnu.linkonce.t.*) |
---|
52 | __TEXT_END = .; |
---|
53 | } > ram |
---|
54 | |
---|
55 | .rdata : |
---|
56 | { |
---|
57 | __RDATA_START = .; |
---|
58 | *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata*) |
---|
59 | __RDATA_END = .; |
---|
60 | } > ram |
---|
61 | |
---|
62 | .ctor ALIGN(4) : |
---|
63 | { |
---|
64 | __CTOR_START = .; |
---|
65 | KEEP (*crtbegin*.o(.ctors)) |
---|
66 | KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) |
---|
67 | KEEP (*(SORT(.ctors.*))) |
---|
68 | KEEP (*(.ctors)) |
---|
69 | __CTOR_END = .; |
---|
70 | } > ram |
---|
71 | |
---|
72 | .dtor ALIGN(4) : |
---|
73 | { |
---|
74 | __DTOR_START = .; |
---|
75 | KEEP (*crtbegin*.o(.dtors)) |
---|
76 | KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) |
---|
77 | KEEP (*(SORT(.dtors.*))) |
---|
78 | KEEP (*(.dtors)) |
---|
79 | __DTOR_END = .; |
---|
80 | } > ram |
---|
81 | |
---|
82 | .data : |
---|
83 | { |
---|
84 | __DATA_START = .; |
---|
85 | *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*) |
---|
86 | *(.eh_frame_hdr) |
---|
87 | *(.eh_frame) |
---|
88 | *(.gcc_except_table) |
---|
89 | *(.got.plt) *(.got) |
---|
90 | __DATA_END = .; |
---|
91 | } > ram |
---|
92 | |
---|
93 | .got : |
---|
94 | { |
---|
95 | *(.got) |
---|
96 | } > ram |
---|
97 | .got.plt : |
---|
98 | { |
---|
99 | *(.got.plt) |
---|
100 | } > ram |
---|
101 | |
---|
102 | .bss (NOLOAD) : |
---|
103 | { |
---|
104 | __BSS_START = .; |
---|
105 | *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*) |
---|
106 | __BSS_END = .; |
---|
107 | } > ram |
---|
108 | |
---|
109 | /* |
---|
110 | You may change the sizes of the following sections to fit the actual |
---|
111 | size your program requires. |
---|
112 | The heap and stack are aligned to the bus width, as a speed optimization |
---|
113 | for accessing data located there. |
---|
114 | */ |
---|
115 | .heap : |
---|
116 | { |
---|
117 | . = ALIGN(4); |
---|
118 | __HEAP_START = .; |
---|
119 | . += 0x2000; |
---|
120 | __HEAP_MAX = .; |
---|
121 | } > ram |
---|
122 | |
---|
123 | .stack : |
---|
124 | { |
---|
125 | . = ALIGN(4); |
---|
126 | . += 0x6000; |
---|
127 | __STACK_START = .; |
---|
128 | } > ram |
---|
129 | |
---|
130 | .istack : |
---|
131 | { |
---|
132 | . = ALIGN(4); |
---|
133 | . += 0x100; |
---|
134 | __ISTACK_START = .; |
---|
135 | } > ram |
---|
136 | } |
---|
137 | |
---|
138 | __DATA_IMAGE_START = LOADADDR(.data); |
---|