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