1 # Linker Script for National Semiconductor's CRX-ELF32.
2 test -z "$RELOCATING" && exit 0
4 # The next line should be uncommented if it is desired to link
5 # without libstart.o and directly enter main.
9 test -z "$ENTRY" && ENTRY=_start
12 /* Example Linker Script for linking NS CRX elf32 files. */
14 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
18 /* Define memory regions. */
21 rom : ORIGIN = 0x2, LENGTH = 3M
22 ram : ORIGIN = 4M, LENGTH = 10M
25 /* Many sections come in three flavours. There is the 'real' section,
26 like ".data". Then there are the per-procedure or per-variable
27 sections, generated by -ffunction-sections and -fdata-sections in GCC,
28 and useful for --gc-sections, which for a variable "foo" might be
29 ".data.foo". Then there are the linkonce sections, for which the linker
30 eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
31 The exact correspondences are:
33 Section Linkonce section
34 .text .gnu.linkonce.t.foo
35 .rdata .gnu.linkonce.r.foo
36 .data .gnu.linkonce.d.foo
37 .bss .gnu.linkonce.b.foo
38 .debug_info .gnu.linkonce.wi.foo */
64 *(.text) *(.text.*) *(.gnu.linkonce.t.*)
71 *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata.*)
78 /* The compiler uses crtbegin.o to find the start
79 of the constructors, so we make sure it is
80 first. Because this is a wildcard, it
81 doesn't matter if the user does not
82 actually link against crtbegin.o; the
83 linker won't look for a file to match a
84 wildcard. The wildcard also means that it
85 doesn't matter which directory crtbegin.o
88 KEEP (*crtbegin.o(.ctors))
89 KEEP (*crtbegin?.o(.ctors))
91 /* We don't want to include the .ctor section from
92 the crtend.o file until after the sorted ctors.
93 The .ctor section from the crtend file contains the
94 end of ctors marker and it must be last */
96 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
97 KEEP (*(SORT(.ctors.*)))
105 KEEP (*crtbegin.o(.dtors))
106 KEEP (*crtbegin?.o(.dtors))
107 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
108 KEEP (*(SORT(.dtors.*)))
116 *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
123 *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
127 /* You may change the sizes of the following sections to fit the actual
128 size your program requires.
130 The heap and stack are aligned to the bus width, as a speed optimization
131 for accessing data located there. */
137 . += 0x2000; __HEAP_MAX = .;
154 .comment 0 : { *(.comment) }
156 /* DWARF debug sections.
157 Symbols in the DWARF debugging sections are relative to the beginning
158 of the section so we begin them at 0. */
160 .debug_aranges 0 : { *(.debug_aranges) }
161 .debug_pubnames 0 : { *(.debug_pubnames) }
162 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
163 .debug_abbrev 0 : { *(.debug_abbrev) }
164 .debug_line 0 : { *(.debug_line) }
165 .debug_frame 0 : { *(.debug_frame) }
166 .debug_str 0 : { *(.debug_str) }
167 .debug_loc 0 : { *(.debug_loc) }
168 .debug_macinfo 0 : { *(.debug_macinfo) }
171 __DATA_IMAGE_START = LOADADDR(.data);