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 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
15 ${RELOCATING+ENTRY(${ENTRY})}
17 /* Define memory regions. */
20 rom : ORIGIN = 0x2, LENGTH = 3M
21 ram : ORIGIN = 4M, LENGTH = 10M
24 /* Many sections come in three flavours. There is the 'real' section,
25 like ".data". Then there are the per-procedure or per-variable
26 sections, generated by -ffunction-sections and -fdata-sections in GCC,
27 and useful for --gc-sections, which for a variable "foo" might be
28 ".data.foo". Then there are the linkonce sections, for which the linker
29 eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
30 The exact correspondences are:
32 Section Linkonce section
33 .text .gnu.linkonce.t.foo
34 .rdata .gnu.linkonce.r.foo
35 .data .gnu.linkonce.d.foo
36 .bss .gnu.linkonce.b.foo
37 .debug_info .gnu.linkonce.wi.foo */
63 *(.text) *(.text.*) *(.gnu.linkonce.t.*)
70 *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata.*)
77 /* The compiler uses crtbegin.o to find the start
78 of the constructors, so we make sure it is
79 first. Because this is a wildcard, it
80 doesn't matter if the user does not
81 actually link against crtbegin.o; the
82 linker won't look for a file to match a
83 wildcard. The wildcard also means that it
84 doesn't matter which directory crtbegin.o
87 KEEP (*crtbegin.o(.ctors))
88 KEEP (*crtbegin?.o(.ctors))
90 /* We don't want to include the .ctor section from
91 the crtend.o file until after the sorted ctors.
92 The .ctor section from the crtend file contains the
93 end of ctors marker and it must be last */
95 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
96 KEEP (*(SORT(.ctors.*)))
104 KEEP (*crtbegin.o(.dtors))
105 KEEP (*crtbegin?.o(.dtors))
106 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
107 KEEP (*(SORT(.dtors.*)))
115 *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
122 *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
126 /* You may change the sizes of the following sections to fit the actual
127 size your program requires.
129 The heap and stack are aligned to the bus width, as a speed optimization
130 for accessing data located there. */
136 . += 0x2000; __HEAP_MAX = .;
153 .comment 0 : { *(.comment) }
155 /* DWARF debug sections.
156 Symbols in the DWARF debugging sections are relative to the beginning
157 of the section so we begin them at 0. */
159 .debug_aranges 0 : { *(.debug_aranges) }
160 .debug_pubnames 0 : { *(.debug_pubnames) }
161 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
162 .debug_abbrev 0 : { *(.debug_abbrev) }
163 .debug_line 0 : { *(.debug_line) }
164 .debug_frame 0 : { *(.debug_frame) }
165 .debug_str 0 : { *(.debug_str) }
166 .debug_loc 0 : { *(.debug_loc) }
167 .debug_macinfo 0 : { *(.debug_macinfo) }
170 __DATA_IMAGE_START = LOADADDR(.data);