Commit | Line | Data |
---|---|---|
9d06555c HPN |
1 | cat <<EOF |
2 | OUTPUT_FORMAT("a.out-cris") | |
3 | OUTPUT_ARCH(cris) | |
596d6d91 | 4 | ${RELOCATING+ENTRY (__start)} |
9d06555c HPN |
5 | SECTIONS |
6 | { | |
7 | .text ${RELOCATING+ ${TEXT_START_ADDR}}: | |
8 | { | |
9 | CREATE_OBJECT_SYMBOLS; | |
8c899858 | 10 | ${CONSTRUCTING+ __Stext = .;} |
9d06555c HPN |
11 | ${RELOCATING+*(.startup)} |
12 | *(.text) | |
8c899858 | 13 | ${CONSTRUCTING+__start = DEFINED(__start) ? __start : |
24dd9f75 HPN |
14 | DEFINED(_start) ? _start : |
15 | DEFINED(start) ? start : | |
16 | DEFINED(.startup) ? .startup + 2 : 2;} | |
9d06555c HPN |
17 | ${RELOCATING+*(.text.*)} |
18 | ${RELOCATING+*(.gnu.linkonce.t*)} | |
19 | ${RELOCATING+*(.rodata)} | |
20 | ${RELOCATING+*(.rodata.*)} | |
21 | ${RELOCATING+*(.gnu.linkonce.r*)} | |
22 | ||
23 | /* Do not "provide" init-start and fini-start symbols; they might be | |
24 | referred to weakly, so the linker would not override the zero | |
25 | default. | |
26 | FIXME: It's somewhat unexpected to have code emitted by the linker | |
27 | script. Some other mechanism could probably do better. */ | |
8c899858 HPN |
28 | ${CONSTRUCTING+ . = ALIGN (2);} |
29 | ${CONSTRUCTING+ ___init__start = .;} | |
30 | ${CONSTRUCTING+ PROVIDE (___do_global_ctors = .);} | |
31 | ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */} | |
32 | ${CONSTRUCTING+ SHORT (0xbe7e);} | |
33 | ${CONSTRUCTING+ *(.init)} | |
34 | ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */} | |
35 | ${CONSTRUCTING+ PROVIDE (__init__end = .);} | |
36 | ${CONSTRUCTING+ PROVIDE (___init__end = .);} | |
37 | ||
38 | ${CONSTRUCTING+ . = ALIGN (2);} | |
39 | ${CONSTRUCTING+ ___fini__start = .;} | |
40 | ${CONSTRUCTING+ PROVIDE (___do_global_dtors = .);} | |
41 | ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */} | |
42 | ${CONSTRUCTING+ SHORT (0xbe7e);} | |
43 | ${CONSTRUCTING+ *(.fini)} | |
44 | ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */} | |
45 | ${CONSTRUCTING+ PROVIDE (__fini__end = .);} | |
46 | ${CONSTRUCTING+ ___fini__end = .;} | |
9d06555c | 47 | |
9d06555c HPN |
48 | /* Cater to linking from ELF. */ |
49 | ${CONSTRUCTING+ PROVIDE(___ctors = .);} | |
50 | ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;} | |
40cf2291 AM |
51 | ${CONSTRUCTING+ KEEP (*crtbegin.o(.ctors))} |
52 | ${CONSTRUCTING+ KEEP (*crtbegin?.o(.ctors))} | |
53 | ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))} | |
9d06555c HPN |
54 | ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))} |
55 | ${CONSTRUCTING+ KEEP (*(.ctors))} | |
56 | ${CONSTRUCTING+ PROVIDE(___ctors_end = .);} | |
57 | ||
58 | ${CONSTRUCTING+ PROVIDE(___dtors = .);} | |
40cf2291 AM |
59 | ${CONSTRUCTING+ KEEP (*crtbegin.o(.dtors))} |
60 | ${CONSTRUCTING+ KEEP (*crtbegin?.o(.dtors))} | |
61 | ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))} | |
9d06555c HPN |
62 | ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))} |
63 | ${CONSTRUCTING+ KEEP (*(.dtors))} | |
64 | ${CONSTRUCTING+ PROVIDE(___dtors_end = .);} | |
65 | ${CONSTRUCTING+ ___elf_ctors_dtors_end = .;} | |
66 | ||
c5975a45 HPN |
67 | /* We include objects that force alignment of the data segment. |
68 | Unfortunately that sometimes causes a gap between .text and .data, | |
69 | which is not detectable since .data does not have a start address | |
70 | of itself in the a.out header. This should only matter for | |
71 | testing; for production use, .data is at a "known" location. | |
72 | We assume .data does not get an alignment larger than 32 bytes. */ | |
8c899858 | 73 | ${CONSTRUCTING+. = ALIGN (32);} |
c5975a45 | 74 | |
8c899858 | 75 | ${CONSTRUCTING+ __Etext = .;} |
9d06555c HPN |
76 | |
77 | /* Deprecated, use __Etext. */ | |
8c899858 | 78 | ${CONSTRUCTING+ PROVIDE(_etext = .);} |
9d06555c HPN |
79 | } |
80 | ||
81 | /* Any dot-relative start-expression (such as "ALIGN(2)", also including | |
82 | the "default" .data alignment expression) will use the initial, raw | |
83 | size of .text and will be incorrect if the alignment used is less | |
84 | than the alignment for .text (which might depend on input and obj | |
85 | format). FIXME: Seems like a bug in ld. Seems hard to fix. Seems | |
86 | unimportant. */ | |
87 | .data : | |
88 | { | |
8c899858 | 89 | ${CONSTRUCTING+ __Sdata = .;} |
9d06555c HPN |
90 | *(.data); |
91 | ${RELOCATING+*(.data.*)} | |
92 | ${RELOCATING+*(.gnu.linkonce.d*)} | |
93 | ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */} | |
94 | ${RELOCATING+*(.gcc_except_table)} | |
c5975a45 HPN |
95 | |
96 | /* See comment at ALIGN before __Etext. */ | |
8c899858 | 97 | ${CONSTRUCTING+. = ALIGN (32);} |
c5975a45 | 98 | |
8c899858 | 99 | ${CONSTRUCTING+ __Edata = .;} |
9d06555c HPN |
100 | |
101 | /* Deprecated, use __Edata. */ | |
8c899858 | 102 | ${CONSTRUCTING+ PROVIDE(_edata = .);} |
9d06555c HPN |
103 | } |
104 | ||
105 | .bss : | |
106 | { | |
107 | /* Deprecated, use __Sbss. */ | |
8c899858 | 108 | ${CONSTRUCTING+ PROVIDE(_bss_start = .);} |
9d06555c | 109 | |
8c899858 | 110 | ${CONSTRUCTING+ __Sbss = .;} |
9d06555c HPN |
111 | *(.bss) |
112 | ${RELOCATING+*(.bss.*)} | |
113 | *(COMMON) | |
8c899858 | 114 | ${CONSTRUCTING+ __Ebss = .;} |
9d06555c HPN |
115 | |
116 | /* Deprecated, use __Ebss or __Eall as appropriate. */ | |
8c899858 HPN |
117 | ${CONSTRUCTING+ PROVIDE(_end = .);} |
118 | ${CONSTRUCTING+ PROVIDE(__end = .);} | |
9d06555c | 119 | } |
8c899858 | 120 | ${CONSTRUCTING+ __Eall = .;} |
9d06555c HPN |
121 | |
122 | /* Unfortunately, stabs are not mappable from ELF to a.out. | |
123 | It can probably be fixed with some amount of work. */ | |
24dd9f75 HPN |
124 | /DISCARD/ : |
125 | { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) } | |
9d06555c HPN |
126 | |
127 | /* For the rsim and xsim simulators. */ | |
8c899858 | 128 | ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);} |
9d06555c HPN |
129 | |
130 | /* For elinux. */ | |
8c899858 | 131 | ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);} |
9d06555c HPN |
132 | } |
133 | EOF |