| 1 | cat <<EOF
|
|---|
| 2 | OUTPUT_FORMAT("a.out-cris")
|
|---|
| 3 | OUTPUT_ARCH(cris)
|
|---|
| 4 | ENTRY(__start)
|
|---|
| 5 | SECTIONS
|
|---|
| 6 | {
|
|---|
| 7 | .text ${RELOCATING+ ${TEXT_START_ADDR}}:
|
|---|
| 8 | {
|
|---|
| 9 | CREATE_OBJECT_SYMBOLS;
|
|---|
| 10 | ${CONSTRUCTING+ __Stext = .;}
|
|---|
| 11 | ${RELOCATING+*(.startup)}
|
|---|
| 12 | *(.text)
|
|---|
| 13 | ${CONSTRUCTING+__start = DEFINED(__start) ? __start :
|
|---|
| 14 | DEFINED(_start) ? _start :
|
|---|
| 15 | DEFINED(start) ? start :
|
|---|
| 16 | DEFINED(.startup) ? .startup + 2 : 2;}
|
|---|
| 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. */
|
|---|
| 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 = .;}
|
|---|
| 47 |
|
|---|
| 48 | /* Cater to linking from ELF. */
|
|---|
| 49 | ${CONSTRUCTING+ PROVIDE(___ctors = .);}
|
|---|
| 50 | ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;}
|
|---|
| 51 | ${CONSTRUCTING+ KEEP (*crtbegin*.o(.ctors))}
|
|---|
| 52 | ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))}
|
|---|
| 53 | ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))}
|
|---|
| 54 | ${CONSTRUCTING+ KEEP (*(.ctors))}
|
|---|
| 55 | ${CONSTRUCTING+ PROVIDE(___ctors_end = .);}
|
|---|
| 56 |
|
|---|
| 57 | ${CONSTRUCTING+ PROVIDE(___dtors = .);}
|
|---|
| 58 | ${CONSTRUCTING+ KEEP (*crtbegin*.o(.dtors))}
|
|---|
| 59 | ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))}
|
|---|
| 60 | ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))}
|
|---|
| 61 | ${CONSTRUCTING+ KEEP (*(.dtors))}
|
|---|
| 62 | ${CONSTRUCTING+ PROVIDE(___dtors_end = .);}
|
|---|
| 63 | ${CONSTRUCTING+ ___elf_ctors_dtors_end = .;}
|
|---|
| 64 |
|
|---|
| 65 | /* We include objects that force alignment of the data segment.
|
|---|
| 66 | Unfortunately that sometimes causes a gap between .text and .data,
|
|---|
| 67 | which is not detectable since .data does not have a start address
|
|---|
| 68 | of itself in the a.out header. This should only matter for
|
|---|
| 69 | testing; for production use, .data is at a "known" location.
|
|---|
| 70 | We assume .data does not get an alignment larger than 32 bytes. */
|
|---|
| 71 | ${CONSTRUCTING+. = ALIGN (32);}
|
|---|
| 72 |
|
|---|
| 73 | ${CONSTRUCTING+ __Etext = .;}
|
|---|
| 74 |
|
|---|
| 75 | /* Deprecated, use __Etext. */
|
|---|
| 76 | ${CONSTRUCTING+ PROVIDE(_etext = .);}
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | /* Any dot-relative start-expression (such as "ALIGN(2)", also including
|
|---|
| 80 | the "default" .data alignment expression) will use the initial, raw
|
|---|
| 81 | size of .text and will be incorrect if the alignment used is less
|
|---|
| 82 | than the alignment for .text (which might depend on input and obj
|
|---|
| 83 | format). FIXME: Seems like a bug in ld. Seems hard to fix. Seems
|
|---|
| 84 | unimportant. */
|
|---|
| 85 | .data :
|
|---|
| 86 | {
|
|---|
| 87 | ${CONSTRUCTING+ __Sdata = .;}
|
|---|
| 88 | *(.data);
|
|---|
| 89 | ${RELOCATING+*(.data.*)}
|
|---|
| 90 | ${RELOCATING+*(.gnu.linkonce.d*)}
|
|---|
| 91 | ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */}
|
|---|
| 92 | ${RELOCATING+*(.gcc_except_table)}
|
|---|
| 93 |
|
|---|
| 94 | /* See comment at ALIGN before __Etext. */
|
|---|
| 95 | ${CONSTRUCTING+. = ALIGN (32);}
|
|---|
| 96 |
|
|---|
| 97 | ${CONSTRUCTING+ __Edata = .;}
|
|---|
| 98 |
|
|---|
| 99 | /* Deprecated, use __Edata. */
|
|---|
| 100 | ${CONSTRUCTING+ PROVIDE(_edata = .);}
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | .bss :
|
|---|
| 104 | {
|
|---|
| 105 | /* Deprecated, use __Sbss. */
|
|---|
| 106 | ${CONSTRUCTING+ PROVIDE(_bss_start = .);}
|
|---|
| 107 |
|
|---|
| 108 | ${CONSTRUCTING+ __Sbss = .;}
|
|---|
| 109 | *(.bss)
|
|---|
| 110 | ${RELOCATING+*(.bss.*)}
|
|---|
| 111 | *(COMMON)
|
|---|
| 112 | ${CONSTRUCTING+ __Ebss = .;}
|
|---|
| 113 |
|
|---|
| 114 | /* Deprecated, use __Ebss or __Eall as appropriate. */
|
|---|
| 115 | ${CONSTRUCTING+ PROVIDE(_end = .);}
|
|---|
| 116 | ${CONSTRUCTING+ PROVIDE(__end = .);}
|
|---|
| 117 | }
|
|---|
| 118 | ${CONSTRUCTING+ __Eall = .;}
|
|---|
| 119 |
|
|---|
| 120 | /* Unfortunately, stabs are not mappable from ELF to a.out.
|
|---|
| 121 | It can probably be fixed with some amount of work. */
|
|---|
| 122 | /DISCARD/ :
|
|---|
| 123 | { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) }
|
|---|
| 124 |
|
|---|
| 125 | /* For the rsim and xsim simulators. */
|
|---|
| 126 | ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);}
|
|---|
| 127 |
|
|---|
| 128 | /* For elinux. */
|
|---|
| 129 | ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);}
|
|---|
| 130 | }
|
|---|
| 131 | EOF
|
|---|