]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/crisaout.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / crisaout.sc
CommitLineData
250d07de 1# Copyright (C) 2014-2021 Free Software Foundation, Inc.
6c19b93b 2#
985743c7
NC
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.
6
9d06555c 7cat <<EOF
250d07de 8/* Copyright (C) 2014-2021 Free Software Foundation, Inc.
985743c7
NC
9
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. */
13
9d06555c
HPN
14OUTPUT_FORMAT("a.out-cris")
15OUTPUT_ARCH(cris)
596d6d91 16${RELOCATING+ENTRY (__start)}
9d06555c
HPN
17SECTIONS
18{
19 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
20 {
21 CREATE_OBJECT_SYMBOLS;
8c899858 22 ${CONSTRUCTING+ __Stext = .;}
9d06555c
HPN
23 ${RELOCATING+*(.startup)}
24 *(.text)
6c19b93b 25 ${CONSTRUCTING+__start = DEFINED(__start) ? __start :
24dd9f75
HPN
26 DEFINED(_start) ? _start :
27 DEFINED(start) ? start :
28 DEFINED(.startup) ? .startup + 2 : 2;}
9d06555c
HPN
29 ${RELOCATING+*(.text.*)}
30 ${RELOCATING+*(.gnu.linkonce.t*)}
31 ${RELOCATING+*(.rodata)}
32 ${RELOCATING+*(.rodata.*)}
33 ${RELOCATING+*(.gnu.linkonce.r*)}
34
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
37 default.
38 FIXME: It's somewhat unexpected to have code emitted by the linker
39 script. Some other mechanism could probably do better. */
8c899858
HPN
40 ${CONSTRUCTING+ . = ALIGN (2);}
41 ${CONSTRUCTING+ ___init__start = .;}
42 ${CONSTRUCTING+ PROVIDE (___do_global_ctors = .);}
43 ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
44 ${CONSTRUCTING+ SHORT (0xbe7e);}
2d3181c7 45 ${CONSTRUCTING+ KEEP (*(SORT_NONE(.init)))}
8c899858
HPN
46 ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
47 ${CONSTRUCTING+ PROVIDE (__init__end = .);}
48 ${CONSTRUCTING+ PROVIDE (___init__end = .);}
49
50 ${CONSTRUCTING+ . = ALIGN (2);}
51 ${CONSTRUCTING+ ___fini__start = .;}
52 ${CONSTRUCTING+ PROVIDE (___do_global_dtors = .);}
53 ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
54 ${CONSTRUCTING+ SHORT (0xbe7e);}
2d3181c7 55 ${CONSTRUCTING+ KEEP (*(SORT_NONE(.fini)))}
8c899858
HPN
56 ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
57 ${CONSTRUCTING+ PROVIDE (__fini__end = .);}
58 ${CONSTRUCTING+ ___fini__end = .;}
9d06555c 59
9d06555c
HPN
60 /* Cater to linking from ELF. */
61 ${CONSTRUCTING+ PROVIDE(___ctors = .);}
62 ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;}
40cf2291
AM
63 ${CONSTRUCTING+ KEEP (*crtbegin.o(.ctors))}
64 ${CONSTRUCTING+ KEEP (*crtbegin?.o(.ctors))}
65 ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
9d06555c
HPN
66 ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))}
67 ${CONSTRUCTING+ KEEP (*(.ctors))}
68 ${CONSTRUCTING+ PROVIDE(___ctors_end = .);}
69
70 ${CONSTRUCTING+ PROVIDE(___dtors = .);}
40cf2291
AM
71 ${CONSTRUCTING+ KEEP (*crtbegin.o(.dtors))}
72 ${CONSTRUCTING+ KEEP (*crtbegin?.o(.dtors))}
73 ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
9d06555c
HPN
74 ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))}
75 ${CONSTRUCTING+ KEEP (*(.dtors))}
76 ${CONSTRUCTING+ PROVIDE(___dtors_end = .);}
77 ${CONSTRUCTING+ ___elf_ctors_dtors_end = .;}
78
c5975a45
HPN
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. */
8c899858 85 ${CONSTRUCTING+. = ALIGN (32);}
c5975a45 86
8c899858 87 ${CONSTRUCTING+ __Etext = .;}
9d06555c
HPN
88
89 /* Deprecated, use __Etext. */
8c899858 90 ${CONSTRUCTING+ PROVIDE(_etext = .);}
9d06555c
HPN
91 }
92
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
98 unimportant. */
99 .data :
100 {
8c899858 101 ${CONSTRUCTING+ __Sdata = .;}
9d06555c
HPN
102 *(.data);
103 ${RELOCATING+*(.data.*)}
104 ${RELOCATING+*(.gnu.linkonce.d*)}
105 ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */}
106 ${RELOCATING+*(.gcc_except_table)}
c5975a45
HPN
107
108 /* See comment at ALIGN before __Etext. */
8c899858 109 ${CONSTRUCTING+. = ALIGN (32);}
c5975a45 110
8c899858 111 ${CONSTRUCTING+ __Edata = .;}
9d06555c
HPN
112
113 /* Deprecated, use __Edata. */
8c899858 114 ${CONSTRUCTING+ PROVIDE(_edata = .);}
9d06555c
HPN
115 }
116
117 .bss :
118 {
119 /* Deprecated, use __Sbss. */
8c899858 120 ${CONSTRUCTING+ PROVIDE(_bss_start = .);}
9d06555c 121
8c899858 122 ${CONSTRUCTING+ __Sbss = .;}
9d06555c
HPN
123 *(.bss)
124 ${RELOCATING+*(.bss.*)}
125 *(COMMON)
8c899858 126 ${CONSTRUCTING+ __Ebss = .;}
9d06555c
HPN
127
128 /* Deprecated, use __Ebss or __Eall as appropriate. */
8c899858
HPN
129 ${CONSTRUCTING+ PROVIDE(_end = .);}
130 ${CONSTRUCTING+ PROVIDE(__end = .);}
9d06555c 131 }
8c899858 132 ${CONSTRUCTING+ __Eall = .;}
9d06555c
HPN
133
134 /* Unfortunately, stabs are not mappable from ELF to a.out.
135 It can probably be fixed with some amount of work. */
24dd9f75
HPN
136 /DISCARD/ :
137 { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) }
9d06555c
HPN
138
139 /* For the rsim and xsim simulators. */
8c899858 140 ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);}
9d06555c
HPN
141
142 /* For elinux. */
8c899858 143 ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);}
9d06555c
HPN
144}
145EOF