]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/hal/m68k/arch/v2_0/src/m68k.ld
Initial revision
[karo-tx-redboot.git] / packages / hal / m68k / arch / v2_0 / src / m68k.ld
1 /*==========================================================================
2 //
3 //      m68k.ld
4 //
5 //      Linker script
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 //
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
16 //
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 // for more details.
21 //
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 //
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
32 //
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
35 //
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //==========================================================================
41 */
42
43 STARTUP(vectors.o)
44 ENTRY(__exception_reset)
45 #ifdef EXTRAS
46 INPUT(extras.o)
47 #endif
48 #if (__GNUC__ >= 3)
49 GROUP(libtarget.a libgcc.a libsupc++.a)
50 #else
51 GROUP(libtarget.a libgcc.a)
52 #endif
53
54 #define ALIGN_LMA 4
55 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
56 #define LMA_EQ_VMA
57 #define FORCE_OUTPUT . = .
58
59 #ifndef CYG_LABEL_DEFN
60 # define CYG_LABEL_DEFN(_label) _label
61 #endif
62
63 #define SECTIONS_BEGIN
64
65 #define SECTION_text(_region_, _vma_, _lma_)           \
66   .text _vma_ : _lma_                                                 \
67   { _stext = .;       \
68     *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) }      \
69   > _region_                                                    \
70   _etext = .;  PROVIDE (etext = .);
71
72 #define SECTION_fini(_region_, _vma_, _lma_)   \
73     .fini _vma_ : _lma_                                       \
74     { FORCE_OUTPUT; *(.fini) }        \
75     > _region_
76
77 #define SECTION_rodata1(_region_, _vma_, _lma_)        \
78     .rodata1 _vma_ : _lma_                                            \
79     { FORCE_OUTPUT; *(.rodata1) }             \
80     > _region_
81
82 #define SECTION_rodata(_region_, _vma_, _lma_) \
83     .rodata _vma_ : _lma_                                     \
84     { FORCE_OUTPUT; *(.rodata*) }     \
85     > _region_
86
87 #define SECTION_fixup(_region_, _vma_, _lma_)                      \
88     .fixup _vma_ : _lma_                                                          \
89     { __FIXUP_START__ = ABSOLUTE(.); *(.fixup) __FIXUP_END__ = ABSOLUTE(.);}\
90     > _region_
91
92 #define SECTION_gcc_except_table(_region_, _vma_, _lma_)       \
93     .gcc_except_table _vma_ : _lma_                                           \
94     { __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table)              \
95       __EXCEPT_END__ = ABSOLUTE(.);}                                    \
96     > _region_
97
98 #define SECTION_data(_region_, _vma_, _lma_, _rom_data_addr_)                 \
99     .data _vma_ : _lma_                                                       \
100     {                                                                         \
101     __ram_data_start = ABSOLUTE(.);                                           \
102     *(.data*)                                                                 \
103     __GOT1_START__ = ABSOLUTE(.); *(.got1) __GOT1_END__ = ABSOLUTE(.);        \
104     . = ALIGN (4);                                                            \
105     KEEP(*( SORT (.ecos.table.*)));                                           \
106     . = ALIGN (4);                                                            \
107     __CTOR_LIST__ = ABSOLUTE(.);                                              \
108     KEEP(*(SORT(.ctors*)));                                                   \
109     __CTOR_END__ = ABSOLUTE(.);                                               \
110     __DTOR_LIST__ = ABSOLUTE(.);                                              \
111     KEEP(*(SORT(.dtors*)))                                                    \
112     __DTOR_END__ = ABSOLUTE(.);                                               \
113     . = ALIGN(8);                                                             \
114     __GOT2_START__ = ABSOLUTE(.); *(.got2) __GOT2_END__ = ABSOLUTE(.);        \
115     __GOT_START = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768);   \
116     _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got)                             \
117     __GOT_END__ = ABSOLUTE(.);  *(.dynamic)                                   \
118     *(.eh_frame)                                                              \
119       /* We want the small data sections together, so single-instruction */   \
120       /* offsets can access them all, and initialized data all before    */   \
121       /* uninitialized, so we can shorten the on-disk segment size.      */   \
122     __SDATA_START__ = ABSOLUTE(.); *(.sdata)                                  \
123     __ram_data_end = ABSOLUTE(.);                                             \
124     __ram_data_size = ABSOLUTE (.) - ABSOLUTE(__ram_data_start);              \
125     }                                                                         \
126     > _region_                                                                \
127     __rom_data_start = ABSOLUTE(_rom_data_addr_);                             \
128     __rom_data_size = SIZEOF(.data);                                          \
129     __rom_data_end = __rom_data_start + __rom_data_size;
130
131 #define SECTION_sbss(_region_, _vma_, _lma_)                                    \
132     .sbss _vma_ : _lma_                                                         \
133     { __sbss_start = ABSOLUTE (.);                                              \
134       __SBSS_START__ = ABSOLUTE(.); *(.sbss) __SBSS_END__ = ABSOLUTE(.);        \
135       *(.scommon)                                                               \
136       __sbss_end = ABSOLUTE (.);                                                \
137       __sbss_size = ABSOLUTE (.) - ABSOLUTE(__sbss_start);                      \
138     }                                                                           \
139     > _region_
140
141 #define SECTION_bss(_region_, _vma_, _lma_)                                     \
142     .bss _vma_ : _lma_                                                          \
143     { __bss_start = ABSOLUTE (.);                                               \
144       FORCE_OUTPUT; *(.dynbss) *(.bss) *(COMMON)                                \
145       __bss_end = ABSOLUTE (.);                                                 \
146       __bss_size = ABSOLUTE (.) - ABSOLUTE(__bss_start);                        \
147     }                                                                           \
148     > _region_
149
150 #define SECTION_stab \
151     .stab 0 (NOLOAD) : \
152     { \
153         *(.stab) \
154     }
155
156 #define SECTION_stabstr \
157     .stabstr 0 (NOLOAD) : \
158     { \
159         *(.stabstr) \
160     }
161
162 #define SECTION_comment \
163     .comment 0 (NOLOAD) : \
164     { \
165         *(.comment) \
166     }
167
168 #define SECTION_heap1(_region_, _vma_, _lma_, _minsize_)                        \
169     .heap1 _vma_ : _lma_                                                        \
170     { __heap1_start = ABSOLUTE (.);                                             \
171       . += (_minsize_);                                                         \
172       __heap1_end = ABSOLUTE (.);                                               \
173       __heap1_size = ABSOLUTE (.) - ABSOLUTE(__heap1_start);                    \
174     }                                                                           \
175     > _region_
176
177 #define SECTION_uninvar(_region_, _vma_, _lma_) \
178     .uninvar _vma_ : _lma_ \
179     { __uninvar_start = ABSOLUTE (.); \
180       FORCE_OUTPUT; *(.uninvar) \
181       __uninvar_end = ABSOLUTE (.); \
182       __uninvar_size = ABSOLUTE (.) - ABSOLUTE(__uninvar_start); \
183     } \
184     > _region_
185
186 #define GENERIC_SECTION(_name_, _region_, _vma_, _lma_, _minsize_)              \
187     . ## _name_ _vma_ : _lma_                                                   \
188     { __ ## _name_ ## _start = ABSOLUTE (.);                                    \
189       FORCE_OUTPUT; *(. ## _name_ ## )                                              \
190       __ ## _name_ ## _datasize = (ABSOLUTE (.) - ABSOLUTE(__ ## _name_ ## _start));      \
191       . += (_minsize_) > (__ ## _name_ ## _datasize) ? (_minsize_) - (__ ## _name_ ## _datasize) : 0; \
192       __ ## _name_ ## _end = ABSOLUTE (.);                                      \
193       __ ## _name_ ## _size = (ABSOLUTE (.) - ABSOLUTE(__ ## _name_ ## _start));          \
194     }                                                                           \
195     > _region_
196
197 #define SECTIONS_END \
198     SECTION_stab \
199     SECTION_stabstr \
200     SECTION_comment \
201     . = ALIGN(4); _end = .; PROVIDE (end = .);
202
203 #include <pkgconf/system.h>
204 #include CYGHWR_MEMORY_LAYOUT_LDI
205