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.*) *(.rodata.*)
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))
94 KEEP (*crtbegin?.o(.ctors))
96 /* We don't want to include the .ctor section from
97 the crtend.o file until after the sorted ctors.
98 The .ctor section from the crtend file contains the
99 end of ctors marker and it must be last */
101 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
102 KEEP (*(SORT(.ctors.*)))
110 KEEP (*crtbegin.o(.dtors))
111 KEEP (*crtbegin?.o(.dtors))
112 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
113 KEEP (*(SORT(.dtors.*)))
121 *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
128 *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
132 /* You may change the sizes of the following sections to fit the actual
133 size your program requires.
135 The heap and stack are aligned to the bus width, as a speed optimization
136 for accessing data located there. */
142 . += 0x2000; __HEAP_MAX = .;
159 .comment 0 : { *(.comment) }
161 /* DWARF debug sections.
162 Symbols in the DWARF debugging sections are relative to the beginning
163 of the section so we begin them at 0. */
165 .debug_aranges 0 : { *(.debug_aranges) }
166 .debug_pubnames 0 : { *(.debug_pubnames) }
167 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
168 .debug_abbrev 0 : { *(.debug_abbrev) }
169 .debug_line 0 : { *(.debug_line) }
170 .debug_frame 0 : { *(.debug_frame) }
171 .debug_str 0 : { *(.debug_str) }
172 .debug_loc 0 : { *(.debug_loc) }
173 .debug_macinfo 0 : { *(.debug_macinfo) }
176 __DATA_IMAGE_START = LOADADDR(.data);