| 1 | # This is for embedded products (no MMU) with ELF.
|
|---|
| 2 | MACHINE=
|
|---|
| 3 | SCRIPT_NAME=elf
|
|---|
| 4 | TEMPLATE_NAME=elf32
|
|---|
| 5 |
|
|---|
| 6 | # Symbols have underscore prepended.
|
|---|
| 7 | OUTPUT_FORMAT="elf32-us-cris"
|
|---|
| 8 | ARCH=cris
|
|---|
| 9 | MAXPAGESIZE=32
|
|---|
| 10 | ENTRY=__start
|
|---|
| 11 | EMBEDDED=yes
|
|---|
| 12 | ALIGNMENT=32
|
|---|
| 13 | TEXT_START_ADDR=0
|
|---|
| 14 |
|
|---|
| 15 | # Put crt0 for flash/eprom etc. in this section.
|
|---|
| 16 | INITIAL_READONLY_SECTIONS='.startup : { KEEP(*(.startup)) }'
|
|---|
| 17 |
|
|---|
| 18 | # Setting __Stext to . in TEXT_START_SYMBOLS doesn't get what we want
|
|---|
| 19 | # most of the time, which is the start of all read-only sections;
|
|---|
| 20 | # there's at least .startup and .init before it. We have to resort to
|
|---|
| 21 | # trickery. Note that __Stext is always defined, not PROVIDE:d, since
|
|---|
| 22 | # external tools look for it.
|
|---|
| 23 | TEXT_START_SYMBOLS='__Stext = ADDR (.startup);'
|
|---|
| 24 |
|
|---|
| 25 | # The __start dance is to get us through assumptions about entry
|
|---|
| 26 | # symbols, and to clear _start for normal use with sane programs.
|
|---|
| 27 | EXECUTABLE_SYMBOLS='
|
|---|
| 28 | __start = DEFINED(__start) ? __start :
|
|---|
| 29 | DEFINED(_start) ? _start :
|
|---|
| 30 | DEFINED(start) ? start :
|
|---|
| 31 | DEFINED(.startup) ? .startup + 2 : 2;
|
|---|
| 32 | '
|
|---|
| 33 |
|
|---|
| 34 | # Smuggle an "OTHER_TEXT_END_SYMBOLS" here.
|
|---|
| 35 | OTHER_READONLY_SECTIONS="${RELOCATING+PROVIDE (__Etext = .);}"
|
|---|
| 36 | DATA_START_SYMBOLS='PROVIDE (__Sdata = .);'
|
|---|
| 37 |
|
|---|
| 38 | # Smuggle an "OTHER_DATA_END_SYMBOLS" here.
|
|---|
| 39 | OTHER_SDATA_SECTIONS="${RELOCATING+PROVIDE (__Edata = .);}"
|
|---|
| 40 |
|
|---|
| 41 | # If .bss does not immediately follow .data but has its own start
|
|---|
| 42 | # address, we can't get to it with OTHER_BSS_SYMBOLS, neither can we
|
|---|
| 43 | # use ADDR(.bss) there. Instead, we use the symbol support for the
|
|---|
| 44 | # end symbol.
|
|---|
| 45 | OTHER_BSS_END_SYMBOLS='
|
|---|
| 46 | PROVIDE (__Ebss = .);
|
|---|
| 47 | PROVIDE (__end = .);
|
|---|
| 48 | __Sbss = ADDR (.bss);
|
|---|
| 49 | PROVIDE (_bss_start = __Sbss);
|
|---|
| 50 | '
|
|---|
| 51 |
|
|---|
| 52 | INIT_START='
|
|---|
| 53 | . = ALIGN(2);
|
|---|
| 54 | ___init__start = .;
|
|---|
| 55 | PROVIDE (___do_global_ctors = .);
|
|---|
| 56 | SHORT (0xe1fc); /* push srp */
|
|---|
| 57 | SHORT (0xbe7e);
|
|---|
| 58 | '
|
|---|
| 59 |
|
|---|
| 60 | INIT_END='
|
|---|
| 61 | SHORT (0x0d3e); /* jump [sp+] */
|
|---|
| 62 | PROVIDE (__init__end = .);
|
|---|
| 63 | PROVIDE (___init__end = .);
|
|---|
| 64 | '
|
|---|
| 65 |
|
|---|
| 66 | FINI_START='
|
|---|
| 67 | . = ALIGN (2);
|
|---|
| 68 | ___fini__start = .;
|
|---|
| 69 | PROVIDE (___do_global_dtors = .);
|
|---|
| 70 | SHORT (0xe1fc); /* push srp */
|
|---|
| 71 | SHORT (0xbe7e);
|
|---|
| 72 | '
|
|---|
| 73 |
|
|---|
| 74 | FINI_END='
|
|---|
| 75 | SHORT (0x0d3e); /* jump [sp+] */
|
|---|
| 76 | PROVIDE (__fini__end = .);
|
|---|
| 77 | ___fini__end = .;
|
|---|
| 78 | '
|
|---|
| 79 |
|
|---|
| 80 | CTOR_START='
|
|---|
| 81 | PROVIDE (___ctors = .);
|
|---|
| 82 | ___elf_ctors_dtors_begin = .;
|
|---|
| 83 | '
|
|---|
| 84 |
|
|---|
| 85 | CTOR_END='
|
|---|
| 86 | PROVIDE (___ctors_end = .);
|
|---|
| 87 | '
|
|---|
| 88 |
|
|---|
| 89 | DTOR_START='
|
|---|
| 90 | PROVIDE (___dtors = .);
|
|---|
| 91 | '
|
|---|
| 92 |
|
|---|
| 93 | CTOR_END='
|
|---|
| 94 | PROVIDE (___dtors_end = .);
|
|---|
| 95 | ___elf_ctors_dtors_end = .;
|
|---|
| 96 | '
|
|---|
| 97 |
|
|---|
| 98 | # Also add the other symbols provided for rsim/xsim and elinux.
|
|---|
| 99 | OTHER_END_SYMBOLS='
|
|---|
| 100 | PROVIDE (__Eall = .);
|
|---|
| 101 | PROVIDE (__Endmem = 0x10000000);
|
|---|
| 102 | PROVIDE (__Stacksize = 0);
|
|---|
| 103 | '
|
|---|
| 104 | NO_SMALL_DATA=yes
|
|---|