1 # Linker Script for National Semiconductor's CRX-ELF32.
3 # The next line should be uncommented if it is desired to link
4 # without libstart.o and directly enter main.
8 test -z "$ENTRY" && ENTRY=_start
11 /* Example Linker Script for linking NS CRX elf32 files. */
13 /* The next line forces the entry point (${ENTRY} 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. */
18 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
23 /* Define memory regions. */
26 rom : ORIGIN = 0x2, LENGTH = 3M
27 ram : ORIGIN = 4M, LENGTH = 10M
30 /* Many sections come in three flavours. There is the 'real' section,
31 like ".data". Then there are the per-procedure or per-variable
32 sections, generated by -ffunction-sections and -fdata-sections in GCC,
33 and useful for --gc-sections, which for a variable "foo" might be
34 ".data.foo". Then there are the linkonce sections, for which the linker
35 eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
36 The exact correspondences are:
38 Section Linkonce section
39 .text .gnu.linkonce.t.foo
40 .rdata .gnu.linkonce.r.foo
41 .data .gnu.linkonce.d.foo
42 .bss .gnu.linkonce.b.foo
43 .debug_info .gnu.linkonce.wi.foo */
69 *(.text) *(.text.*) *(.gnu.linkonce.t.*)
76 *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*)
83 /* The compiler uses crtbegin.o to find the start
84 of the constructors, so we make sure it is
85 first. Because this is a wildcard, it
86 doesn't matter if the user does not
87 actually link against crtbegin.o; the
88 linker won't look for a file to match a
89 wildcard. The wildcard also means that it
90 doesn't matter which directory crtbegin.o
93 KEEP (*crtbegin*.o(.ctors))
95 /* We don't want to include the .ctor section from
96 the crtend.o file until after the sorted ctors.
97 The .ctor section from the crtend file contains the
98 end of ctors marker and it must be last */
100 KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
101 KEEP (*(SORT(.ctors.*)))
109 KEEP (*crtbegin*.o(.dtors))
110 KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
111 KEEP (*(SORT(.dtors.*)))
119 *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
126 *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
130 /* You may change the sizes of the following sections to fit the actual
131 size your program requires.
133 The heap and stack are aligned to the bus width, as a speed optimization
134 for accessing data located there. */
140 . += 0x2000; __HEAP_MAX = .;
157 .comment 0 : { *(.comment) }
159 /* DWARF debug sections.
160 Symbols in the DWARF debugging sections are relative to the beginning
161 of the section so we begin them at 0. */
163 .debug_aranges 0 : { *(.debug_aranges) }
164 .debug_pubnames 0 : { *(.debug_pubnames) }
165 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
166 .debug_abbrev 0 : { *(.debug_abbrev) }
167 .debug_line 0 : { *(.debug_line) }
168 .debug_frame 0 : { *(.debug_frame) }
169 .debug_str 0 : { *(.debug_str) }
170 .debug_loc 0 : { *(.debug_loc) }
171 .debug_macinfo 0 : { *(.debug_macinfo) }
174 __DATA_IMAGE_START = LOADADDR(.data);