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
7TORS=".tors :
8	{
9	  ___ctors = . ;
10	  *(.ctors)
11	  ___ctors_end = . ;
12	  ___dtors = . ;
13	  *(.dtors)
14	  ___dtors_end = . ;
15	} > ram"
16
17cat <<EOF
18/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
19
20   Copying and distribution of this script, with or without modification,
21   are permitted in any medium without royalty provided the copyright
22   notice and this notice are preserved.  */
23
24OUTPUT_FORMAT("${OUTPUT_FORMAT}")
25OUTPUT_ARCH(h8300sxn)
26${RELOCATING+ENTRY ("_start")}
27
28MEMORY
29{
30	/* 0xc4 is a magic entry.  We should have the linker just
31	   skip over it one day...  */
32	vectors : o = 0x0000, l = 0xc4
33	magicvectors : o = 0xc4, l = 0x3c
34	ram    : o = 0x0100, l = 0xfdfc
35	/* The stack starts at the top of main ram.  */
36	topram : o = 0xfefc, l = 0x4
37	/* At the very top of the address space is the 8-bit area.  */
38	eight : o = 0xff00, l = 0x100
39}
40
41SECTIONS
42{
43.vectors :
44	{
45	  /* Use something like this to place a specific
46	     function's address into the vector table.
47
48	     SHORT (ABSOLUTE (_foobar)).  */
49
50	  *(.vectors)
51	} ${RELOCATING+ > vectors}
52
53.text :
54	{
55	  *(.rodata)
56	  *(.text)
57	  *(.strings)
58   	  ${RELOCATING+ _etext = . ; }
59	} ${RELOCATING+ > ram}
60
61${CONSTRUCTING+${TORS}}
62
63.data :
64	{
65	  *(.data)
66	  *(.tiny)
67	  ${RELOCATING+ _edata = . ; }
68	} ${RELOCATING+ > ram}
69
70.bss :
71	{
72	  ${RELOCATING+ _bss_start = . ;}
73	  *(.bss)
74	  *(COMMON)
75	  ${RELOCATING+ _end = . ;  }
76	} ${RELOCATING+ >ram}
77
78.stack :
79	{
80	  ${RELOCATING+ _stack = . ; }
81	  *(.stack)
82	} ${RELOCATING+ > topram}
83
84.eight :
85	{
86	  *(.eight)
87	} ${RELOCATING+ > eight}
88
89.stab 0 ${RELOCATING+(NOLOAD)} :
90	{
91	  [ .stab ]
92	}
93
94.stabstr 0 ${RELOCATING+(NOLOAD)} :
95	{
96	  [ .stabstr ]
97	}
98}
99EOF
100