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