1 # Copyright (C) 2014-2019 Free Software Foundation, Inc.
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.
8 /* Copyright (C) 2014-2019 Free Software Foundation, Inc.
10 Copying and distribution of this script, with or without modification,
11 are permitted in any medium without royalty provided the copyright
12 notice and this notice are preserved. */
14 OUTPUT_FORMAT("a.out-cris")
16 ${RELOCATING+ENTRY (__start)}
19 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
21 CREATE_OBJECT_SYMBOLS;
22 ${CONSTRUCTING+ __Stext = .;}
23 ${RELOCATING+*(.startup)}
25 ${CONSTRUCTING+__start = DEFINED(__start) ? __start :
26 DEFINED(_start) ? _start :
27 DEFINED(start) ? start :
28 DEFINED(.startup) ? .startup + 2 : 2;}
29 ${RELOCATING+*(.text.*)}
30 ${RELOCATING+*(.gnu.linkonce.t*)}
31 ${RELOCATING+*(.rodata)}
32 ${RELOCATING+*(.rodata.*)}
33 ${RELOCATING+*(.gnu.linkonce.r*)}
35 /* Do not "provide" init-start and fini-start symbols; they might be
36 referred to weakly, so the linker would not override the zero
38 FIXME: It's somewhat unexpected to have code emitted by the linker
39 script. Some other mechanism could probably do better. */
40 ${CONSTRUCTING+ . = ALIGN (2);}
41 ${CONSTRUCTING+ ___init__start = .;}
42 ${CONSTRUCTING+ PROVIDE (___do_global_ctors = .);}
43 ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
44 ${CONSTRUCTING+ SHORT (0xbe7e);}
45 ${CONSTRUCTING+ KEEP (*(SORT_NONE(.init)))}
46 ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
47 ${CONSTRUCTING+ PROVIDE (__init__end = .);}
48 ${CONSTRUCTING+ PROVIDE (___init__end = .);}
50 ${CONSTRUCTING+ . = ALIGN (2);}
51 ${CONSTRUCTING+ ___fini__start = .;}
52 ${CONSTRUCTING+ PROVIDE (___do_global_dtors = .);}
53 ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
54 ${CONSTRUCTING+ SHORT (0xbe7e);}
55 ${CONSTRUCTING+ KEEP (*(SORT_NONE(.fini)))}
56 ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
57 ${CONSTRUCTING+ PROVIDE (__fini__end = .);}
58 ${CONSTRUCTING+ ___fini__end = .;}
60 /* Cater to linking from ELF. */
61 ${CONSTRUCTING+ PROVIDE(___ctors = .);}
62 ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;}
63 ${CONSTRUCTING+ KEEP (*crtbegin.o(.ctors))}
64 ${CONSTRUCTING+ KEEP (*crtbegin?.o(.ctors))}
65 ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
66 ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))}
67 ${CONSTRUCTING+ KEEP (*(.ctors))}
68 ${CONSTRUCTING+ PROVIDE(___ctors_end = .);}
70 ${CONSTRUCTING+ PROVIDE(___dtors = .);}
71 ${CONSTRUCTING+ KEEP (*crtbegin.o(.dtors))}
72 ${CONSTRUCTING+ KEEP (*crtbegin?.o(.dtors))}
73 ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
74 ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))}
75 ${CONSTRUCTING+ KEEP (*(.dtors))}
76 ${CONSTRUCTING+ PROVIDE(___dtors_end = .);}
77 ${CONSTRUCTING+ ___elf_ctors_dtors_end = .;}
79 /* We include objects that force alignment of the data segment.
80 Unfortunately that sometimes causes a gap between .text and .data,
81 which is not detectable since .data does not have a start address
82 of itself in the a.out header. This should only matter for
83 testing; for production use, .data is at a "known" location.
84 We assume .data does not get an alignment larger than 32 bytes. */
85 ${CONSTRUCTING+. = ALIGN (32);}
87 ${CONSTRUCTING+ __Etext = .;}
89 /* Deprecated, use __Etext. */
90 ${CONSTRUCTING+ PROVIDE(_etext = .);}
93 /* Any dot-relative start-expression (such as "ALIGN(2)", also including
94 the "default" .data alignment expression) will use the initial, raw
95 size of .text and will be incorrect if the alignment used is less
96 than the alignment for .text (which might depend on input and obj
97 format). FIXME: Seems like a bug in ld. Seems hard to fix. Seems
101 ${CONSTRUCTING+ __Sdata = .;}
103 ${RELOCATING+*(.data.*)}
104 ${RELOCATING+*(.gnu.linkonce.d*)}
105 ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */}
106 ${RELOCATING+*(.gcc_except_table)}
108 /* See comment at ALIGN before __Etext. */
109 ${CONSTRUCTING+. = ALIGN (32);}
111 ${CONSTRUCTING+ __Edata = .;}
113 /* Deprecated, use __Edata. */
114 ${CONSTRUCTING+ PROVIDE(_edata = .);}
119 /* Deprecated, use __Sbss. */
120 ${CONSTRUCTING+ PROVIDE(_bss_start = .);}
122 ${CONSTRUCTING+ __Sbss = .;}
124 ${RELOCATING+*(.bss.*)}
126 ${CONSTRUCTING+ __Ebss = .;}
128 /* Deprecated, use __Ebss or __Eall as appropriate. */
129 ${CONSTRUCTING+ PROVIDE(_end = .);}
130 ${CONSTRUCTING+ PROVIDE(__end = .);}
132 ${CONSTRUCTING+ __Eall = .;}
134 /* Unfortunately, stabs are not mappable from ELF to a.out.
135 It can probably be fixed with some amount of work. */
137 { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) }
139 /* For the rsim and xsim simulators. */
140 ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);}
143 ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);}