source: rtems/c/src/lib/libbsp/m68k/efi332/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: 3.8 KB
Line 
1/*  linkcmds
2 *
3 *  $Id$
4 */
5
6OUTPUT_ARCH(m68k)
7__DYNAMIC  =  0;
8
9/*
10 * The memory map looks like this:
11 * +--------------------+ <- low memory
12 * | .text              |
13 * |        etext       |
14 * |        ctor list   | the ctor and dtor lists are for
15 * |        dtor list   | C++ support
16 * |        _endtext    |
17 * +--------------------+
18 * | .data              | initialized data goes here
19 * |        _sdata      |
20 * |        _edata      |
21 * +--------------------+
22 * | .bss               |
23 * |        __bss_start | start of bss, cleared by crt0
24 * |        _end        | start of heap, used by sbrk()
25 * +--------------------+
26 * |    heap space      |
27 * |        _ENDHEAP    |
28 * |    stack space     |
29 * |        __stack     | top of stack
30 * +--------------------+ <- high memory
31 */
32
33/*
34 * Declare some sizes.
35 */
36HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
37StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
38
39MEMORY
40{
41  ram     : ORIGIN = 0x80000, LENGTH = 512K
42}
43
44__end_of_ram = 0x100000;
45_copy_data_from_rom = 0;
46
47/*
48 * stick everything in ram (of course)
49 */
50SECTIONS
51{
52        ram : {
53                . = .;
54        } >ram
55
56        /*
57         * Text, data and bss segments
58         */
59        .text : {
60                *(.text)
61
62                /*
63                 * C++ constructors/destructors
64                 */
65                *(.gnu.linkonce.t.*)
66
67                /*
68                 * Initialization and finalization code.
69                 *
70                 * Various files can provide initialization and finalization
71                 * functions.  crtbegin.o and crtend.o are two instances. The
72                 * body of these functions are in .init and .fini sections. We
73                 * accumulate the bodies here, and prepend function prologues
74                 * from crti.o and function epilogues from crtn.o. crti.o must
75                 * be linked first; crtn.o must be linked last.  Because these
76                 * are wildcards, it doesn't matter if the user does not
77                 * actually link against crti.o and crtn.o; the linker won't
78                 * look for a file to match a wildcard.  The wildcard also
79                 * means that it doesn't matter which directory crti.o and
80                 * crtn.o are in.
81                 */
82                PROVIDE (_init = .);
83                *crti.o(.init)
84                *(.init)
85                *crtn.o(.init)
86                PROVIDE (_fini = .);
87                *crti.o(.fini)
88                *(.fini)
89                *crtn.o(.fini)
90
91                /*
92                 * C++ constructors/destructors
93                 *
94                 * gcc uses crtbegin.o to find the start of the constructors
95                 * and destructors so we make sure it is first.  Because this
96                 * is a wildcard, it doesn't matter if the user does not
97                 * actually link against crtbegin.o; the linker won't look for
98                 * a file to match a wildcard.  The wildcard also means that
99                 * it doesn't matter which directory crtbegin.o is in. The
100                 * constructor and destructor list are terminated in
101                 * crtend.o.  The same comments apply to it.
102                 */
103                . = ALIGN (16);
104                *crtbegin.o(.ctors)
105                *(.ctors)
106                *crtend.o(.ctors)
107                *crtbegin.o(.dtors)
108                *(.dtors)
109                *crtend.o(.dtors)
110
111                /*
112                 * Exception frame info
113                 */
114                . = ALIGN (16);
115                *(.eh_frame)
116
117                /*
118                 * Read-only data
119                 */
120                . = ALIGN (16);
121                _rodata_start = . ;
122                *(.rodata)
123                *(.gnu.linkonce.r*)
124
125                 . = ALIGN (16);
126                PROVIDE (_etext = .);
127        } >ram
128        .data : {
129                PROVIDE (_copy_start = .);
130                *(.data)
131                *(.gnu.linkonce.d*)
132                *(.gcc_except_table)
133                . = ALIGN (16);
134                PROVIDE (_edata = .);
135                PROVIDE (_copy_end = .);
136        } >ram
137        .bss : {
138                PROVIDE (_bss_start = .);
139                PROVIDE (_clear_start = .);
140                *(.bss)
141                *(COMMON)
142                . = ALIGN (16);
143                PROVIDE (end = .);
144
145                . += StackSize;
146                PROVIDE (_stack_init = .);
147
148                . = ALIGN (16);
149                PROVIDE (_HeapStart = .);
150                . += HeapSize;
151                PROVIDE (_HeapEnd = .);
152
153                clear_end = .;
154
155                PROVIDE (_WorkspaceBase = .);
156        } >ram
157}
Note: See TracBrowser for help on using the repository browser.