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