| 1 | TORS=".tors : | 
|---|
| 2 | { | 
|---|
| 3 | ___ctors = . ; | 
|---|
| 4 | *(.ctors) | 
|---|
| 5 | ___ctors_end = . ; | 
|---|
| 6 | ___dtors = . ; | 
|---|
| 7 | *(.dtors) | 
|---|
| 8 | ___dtors_end = . ; | 
|---|
| 9 | } > ram" | 
|---|
| 10 |  | 
|---|
| 11 | cat <<EOF | 
|---|
| 12 | OUTPUT_FORMAT("${OUTPUT_FORMAT}") | 
|---|
| 13 | OUTPUT_ARCH(h8300h) | 
|---|
| 14 | ENTRY("_start") | 
|---|
| 15 |  | 
|---|
| 16 | /* The memory size is 256KB to coincide with the simulator. | 
|---|
| 17 | Don't change either without considering the other.  */ | 
|---|
| 18 |  | 
|---|
| 19 | MEMORY | 
|---|
| 20 | { | 
|---|
| 21 | /* 0xc4 is a magic entry.  We should have the linker just | 
|---|
| 22 | skip over it one day...  */ | 
|---|
| 23 | vectors : o = 0x0000, l = 0xc4 | 
|---|
| 24 | magicvectors : o = 0xc4, l = 0x3c | 
|---|
| 25 | /* We still only use 256k as the main ram size.  */ | 
|---|
| 26 | ram    : o = 0x0100, l = 0x3fefc | 
|---|
| 27 | /* The stack starts at the top of main ram.  */ | 
|---|
| 28 | topram : o = 0x3fffc, l = 0x4 | 
|---|
| 29 | /* This holds variables in the "tiny" sections.  */ | 
|---|
| 30 | tiny   : o = 0xff8000, l = 0x7f00 | 
|---|
| 31 | /* At the very top of the address space is the 8-bit area.  */ | 
|---|
| 32 | eight  : o = 0xffff00, l = 0x100 | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | SECTIONS | 
|---|
| 36 | { | 
|---|
| 37 | .vectors : | 
|---|
| 38 | { | 
|---|
| 39 | /* Use something like this to place a specific | 
|---|
| 40 | function's address into the vector table. | 
|---|
| 41 |  | 
|---|
| 42 | LONG (ABSOLUTE (_foobar)).  */ | 
|---|
| 43 |  | 
|---|
| 44 | *(.vectors) | 
|---|
| 45 | } ${RELOCATING+ > vectors} | 
|---|
| 46 |  | 
|---|
| 47 | .text : | 
|---|
| 48 | { | 
|---|
| 49 | *(.rodata) | 
|---|
| 50 | *(.text) | 
|---|
| 51 | *(.strings) | 
|---|
| 52 | ${RELOCATING+ _etext = . ; } | 
|---|
| 53 | } ${RELOCATING+ > ram} | 
|---|
| 54 |  | 
|---|
| 55 | ${CONSTRUCTING+${TORS}} | 
|---|
| 56 |  | 
|---|
| 57 | .data : | 
|---|
| 58 | { | 
|---|
| 59 | *(.data) | 
|---|
| 60 | ${RELOCATING+ _edata = . ; } | 
|---|
| 61 | } ${RELOCATING+ > ram} | 
|---|
| 62 |  | 
|---|
| 63 | .bss : | 
|---|
| 64 | { | 
|---|
| 65 | ${RELOCATING+ _bss_start = . ;} | 
|---|
| 66 | *(.bss) | 
|---|
| 67 | *(COMMON) | 
|---|
| 68 | ${RELOCATING+ _end = . ;  } | 
|---|
| 69 | } ${RELOCATING+ >ram} | 
|---|
| 70 |  | 
|---|
| 71 | .stack : | 
|---|
| 72 | { | 
|---|
| 73 | ${RELOCATING+ _stack = . ; } | 
|---|
| 74 | *(.stack) | 
|---|
| 75 | } ${RELOCATING+ > topram} | 
|---|
| 76 |  | 
|---|
| 77 | .tiny : | 
|---|
| 78 | { | 
|---|
| 79 | *(.tiny) | 
|---|
| 80 | } ${RELOCATING+ > tiny} | 
|---|
| 81 |  | 
|---|
| 82 | .eight : | 
|---|
| 83 | { | 
|---|
| 84 | *(.eight) | 
|---|
| 85 | } ${RELOCATING+ > eight} | 
|---|
| 86 |  | 
|---|
| 87 | .stab 0 ${RELOCATING+(NOLOAD)} : | 
|---|
| 88 | { | 
|---|
| 89 | [ .stab ] | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 | .stabstr 0 ${RELOCATING+(NOLOAD)} : | 
|---|
| 93 | { | 
|---|
| 94 | [ .stabstr ] | 
|---|
| 95 | } | 
|---|
| 96 | } | 
|---|
| 97 | EOF | 
|---|