1# Copyright (C) 2014-2016 Free Software Foundation, Inc. 2# 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 7cat <<EOF 8/* Copyright (C) 2014-2016 Free Software Foundation, Inc. 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 14OUTPUT_FORMAT("a.out-cris") 15OUTPUT_ARCH(cris) 16${RELOCATING+ENTRY (__start)} 17SECTIONS 18{ 19 .text ${RELOCATING+ ${TEXT_START_ADDR}}: 20 { 21 CREATE_OBJECT_SYMBOLS; 22 ${CONSTRUCTING+ __Stext = .;} 23 ${RELOCATING+*(.startup)} 24 *(.text) 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*)} 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. */ 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+ *(.init)} 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);} 55 ${CONSTRUCTING+ *(.fini)} 56 ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */} 57 ${CONSTRUCTING+ PROVIDE (__fini__end = .);} 58 ${CONSTRUCTING+ ___fini__end = .;} 59 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 = .);} 69 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 = .;} 78 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);} 86 87 ${CONSTRUCTING+ __Etext = .;} 88 89 /* Deprecated, use __Etext. */ 90 ${CONSTRUCTING+ PROVIDE(_etext = .);} 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 { 101 ${CONSTRUCTING+ __Sdata = .;} 102 *(.data); 103 ${RELOCATING+*(.data.*)} 104 ${RELOCATING+*(.gnu.linkonce.d*)} 105 ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */} 106 ${RELOCATING+*(.gcc_except_table)} 107 108 /* See comment at ALIGN before __Etext. */ 109 ${CONSTRUCTING+. = ALIGN (32);} 110 111 ${CONSTRUCTING+ __Edata = .;} 112 113 /* Deprecated, use __Edata. */ 114 ${CONSTRUCTING+ PROVIDE(_edata = .);} 115 } 116 117 .bss : 118 { 119 /* Deprecated, use __Sbss. */ 120 ${CONSTRUCTING+ PROVIDE(_bss_start = .);} 121 122 ${CONSTRUCTING+ __Sbss = .;} 123 *(.bss) 124 ${RELOCATING+*(.bss.*)} 125 *(COMMON) 126 ${CONSTRUCTING+ __Ebss = .;} 127 128 /* Deprecated, use __Ebss or __Eall as appropriate. */ 129 ${CONSTRUCTING+ PROVIDE(_end = .);} 130 ${CONSTRUCTING+ PROVIDE(__end = .);} 131 } 132 ${CONSTRUCTING+ __Eall = .;} 133 134 /* Unfortunately, stabs are not mappable from ELF to a.out. 135 It can probably be fixed with some amount of work. */ 136 /DISCARD/ : 137 { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) } 138 139 /* For the rsim and xsim simulators. */ 140 ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);} 141 142 /* For elinux. */ 143 ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);} 144} 145EOF 146