source: rtems/c/src/lib/libbsp/m68k/gen68340/startup/linkcmds @ b2b4835

4.104.114.84.95
Last change on this file since b2b4835 was b2b4835, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 12, 2000 at 4:38:57 PM

Eric Norum <eric@…> submitted linker script and bsp_specs
for the gen68360 that let it work with ELF and C++ exceptions. This
was used as the basis for changes to EVERY m68k bsp_specs and linkcmds.
Before this modification is over, the layout of the starting stack,
heap, and workspace will likely be modified for every m68k BSP. Then
they will all be very similar.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 * This file contains GNU linker directives for a generic MC68340/349 board.
3 * Variations in hardware type and dynamic memory size can be made
4 * by overriding some values with linker command-line arguments.
5 *
6 * ATTENTION: RAM and ROM placement must accord those in start340.S!!
7 *            (next time I'll use some shared variables :) )
8 *
9 * Geoffroy Montel
10 * France Telecom - CNET/DSM/TAM/CAT
11 * 4, rue du Clos Courtel
12 * 35512 CESSON-SEVIGNE
13 * FRANCE
14 *
15 * e-mail: g_montel@yahoo.com
16 *
17 *  $Id$
18 */
19
20/*
21 * a.out format doesn't handle prom images very well
22 */
23OUTPUT_FORMAT(coff-m68k)
24
25/*
26 * Declare some sizes.
27 */
28RamSize = DEFINED(RamSize) ? RamSize : 4M;
29HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
30StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
31
32/*
33 * Declare on-board memory.
34 * It would be nice if the ram length could be given as
35 * LENGTH=RamSize, but gld doesn't allow non-constant
36 * values in the LENGTH expression. 
37 */
38MEMORY {
39          ram : ORIGIN = 0x10000000, LENGTH = 4M
40          rom : ORIGIN = 0x01000000, LENGTH = 4M
41/*        dpram : ORIGIN = 0xFE000000, LENGTH = 8k */
42}
43
44/*
45 * Declare low-order three octets of Ethernet address.
46 */
47ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
48
49/*
50 * Load objects
51 */
52SECTIONS {
53        /*
54         * Hardware variations
55         */
56        _RamSize = RamSize;
57        __RamSize = RamSize;
58
59        /*
60         * Boot PROM
61         */
62        rom : {
63                _RomBase = .;
64                __RomBase = .;
65        } >rom
66
67        /*
68         * Dynamic RAM
69         */
70        ram : {
71                _RamBase = .;
72                __RamBase = .;
73        } >ram
74
75        /*
76         * Text, data and bss segments
77         */
78        .text : {
79                *(.text)
80
81                /*
82                 * C++ constructors/destructors
83                 */
84                *(.gnu.linkonce.t.*)
85
86                /*
87                 * Initialization and finalization code.
88                 *
89                 * Various files can provide initialization and finalization
90                 * functions.  crtbegin.o and crtend.o are two instances. The
91                 * body of these functions are in .init and .fini sections. We
92                 * accumulate the bodies here, and prepend function prologues
93                 * from crti.o and function epilogues from crtn.o. crti.o must
94                 * be linked first; crtn.o must be linked last.  Because these
95                 * are wildcards, it doesn't matter if the user does not
96                 * actually link against crti.o and crtn.o; the linker won't
97                 * look for a file to match a wildcard.  The wildcard also
98                 * means that it doesn't matter which directory crti.o and
99                 * crtn.o are in.
100                 */
101                PROVIDE (_init = .);
102                *crti.o(.init)
103                *(.init)
104                *crtn.o(.init)
105                PROVIDE (_fini = .);
106                *crti.o(.fini)
107                *(.fini)
108                *crtn.o(.fini)
109
110                /*
111                 * C++ constructors/destructors
112                 *
113                 * gcc uses crtbegin.o to find the start of the constructors
114                 * and destructors so we make sure it is first.  Because this
115                 * is a wildcard, it doesn't matter if the user does not
116                 * actually link against crtbegin.o; the linker won't look for
117                 * a file to match a wildcard.  The wildcard also means that
118                 * it doesn't matter which directory crtbegin.o is in. The
119                 * constructor and destructor list are terminated in
120                 * crtend.o.  The same comments apply to it.
121                 */
122                . = ALIGN (16);
123                *crtbegin.o(.ctors)
124                *(.ctors)
125                *crtend.o(.ctors)
126                *crtbegin.o(.dtors)
127                *(.dtors)
128                *crtend.o(.dtors)
129
130                /*
131                 * Exception frame info
132                 */
133                . = ALIGN (16);
134                *(.eh_frame)
135
136                /*
137                 * Read-only data
138                 */
139                . = ALIGN (16);
140                _rodata_start = . ;
141                *(.rodata)
142                *(.gnu.linkonce.r*)
143
144                 . = ALIGN (16);
145                PROVIDE (_etext = .);
146        } >ram
147        .data : {
148                PROVIDE (_copy_start = .);
149                *(.data)
150                *(.gnu.linkonce.d*)
151                *(.gcc_except_table)
152                . = ALIGN (16);
153                PROVIDE (_edata = .);
154                PROVIDE (_copy_end = .);
155        } >ram
156        .bss : {
157                M68Kvec = .;
158                _M68Kvec = .;
159                . += (256 * 4);
160                PROVIDE (_bss_start = .);
161                PROVIDE (_clear_start = .);
162                *(.bss)
163                *(COMMON)
164                . = ALIGN (16);
165                PROVIDE (end = .);
166
167                . += StackSize;
168                PROVIDE (_stack_init = .);
169
170                . = ALIGN (16);
171                PROVIDE (_HeapStart = .);
172                . += HeapSize;
173                PROVIDE (_HeapEnd = .);
174
175                clear_end = .;
176
177                PROVIDE (_WorkspaceBase = .);
178        } >ram
179
180       /*
181        * On-chip memory/peripherals
182        *
183        */
184        dpram : {
185                m340 = .;
186                _m340 = .;
187                . += (8 * 1024);
188        } >ram
189
190}
Note: See TracBrowser for help on using the repository browser.