source: rtems/c/src/lib/libbsp/sparc/shared/startup/linkcmds.base @ fac8a3a

5
Last change on this file since fac8a3a was fac8a3a, checked in by Sebastian Huber <sebastian.huber@…>, on 11/02/16 at 09:01:36

bsps/sparc: Fix copy of initialized data

The text and data sections may have different alignment requirements.
Support a data section alignment greater than 16.

  • Property mode set to 100644
File size: 4.8 KB
RevLine 
[c8941b0]1/*  linkcmds
2 */
3
4OUTPUT_ARCH(sparc)
5__DYNAMIC  =  0;
[24a6943]6ENTRY(start)
[c8941b0]7
8/*
9 * The memory map looks like this:
10 * +--------------------+ <- low memory
11 * | .text              |
12 * |        etext       |
13 * |        ctor list   | the ctor and dtor lists are for
14 * |        dtor list   | C++ support
15 * |        _endtext    |
16 * +--------------------+
17 * | .data              | initialized data goes here
18 * |        _sdata      |
19 * |        _edata      |
20 * +--------------------+
21 * | .bss               |
22 * |        __bss_start | start of bss, cleared by crt0
23 * |        _end        | start of heap, used by sbrk()
24 * +--------------------+
25 * |    heap space      |
26 * |        _ENDHEAP    |
27 * |    stack space     |
28 * |        __stack     | top of stack
29 * +--------------------+ <- high memory
30 */
31
32_RAM_END = _RAM_START + _RAM_SIZE;
33
34_PROM_END = _PROM_START + _PROM_SIZE;
35
36/*
37 *  Alternate names without leading _.
38 */
39
40PROM_START = _PROM_START;
41PROM_SIZE = _PROM_SIZE;
42PROM_END = _PROM_END;
43
44RAM_START = _RAM_START;
45RAM_SIZE = _RAM_SIZE;
46RAM_END = _RAM_END;
47
48/*
49 * SPARC monitor assumes this is present to provide proper RTEMS awareness.
50 */
51EXTERN(rtems_get_version_string);
52
53/*
54 * stick everything in ram (of course)
55 */
56SECTIONS
57{
58  .text :
59  {
60    CREATE_OBJECT_SYMBOLS
61    text_start = .;
62    _text_start = .;
63    *(.text*)
64    . = ALIGN (16);
65
[95cb09e]66    KEEP(*(.eh_frame*))
[c8941b0]67    . = ALIGN (16);
68
69    *(.gnu.linkonce.t*)
70
71    /*
72     * C++ constructors
73     */
74    /* gcc uses crtbegin.o to find the start of
75       the constructors, so we make sure it is
76       first.  Because this is a wildcard, it
77       doesn't matter if the user does not
78       actually link against crtbegin.o; the
79       linker won't look for a file to match a
80       wildcard.  The wildcard also means that it
81       doesn't matter which directory crtbegin.o
82       is in.  */
83    KEEP (*crtbegin.o(.ctors))
84    KEEP (*crtbegin?.o(.ctors))
85    /* We don't want to include the .ctor section from
86       the crtend.o file until after the sorted ctors.
87       The .ctor section from the crtend file contains the
88       end of ctors marker and it must be last */
89    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
[95cb09e]90    KEEP (*(SORT(.ctors*)))
[c8941b0]91    KEEP (*crtbegin.o(.dtors))
92    KEEP (*crtbegin?.o(.dtors))
93    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
[95cb09e]94    KEEP (*(SORT(.dtors*)))
[c8941b0]95
96    _rodata_start = . ;
97    *(.rodata*)
98    *(.gnu.linkonce.r*)
99    _erodata = ALIGN( 0x10 ) ;
100
101    etext = ALIGN(0x10);
102    _etext = .;
[95cb09e]103    KEEP(*(.init*))
104    KEEP(*(.fini*))
[c8941b0]105    *(.lit)
106    *(.shdata)
107    . = ALIGN (16);
108  } > ram
[960fd85]109  .tdata : {
110    _TLS_Data_begin = .;
111    *(.tdata .tdata.* .gnu.linkonce.td.*)
112    _TLS_Data_end = .;
113  } > ram
114  .tbss : {
115    _TLS_BSS_begin = .;
116    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
117    _TLS_BSS_end = .;
118  } > ram
119  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
[d60e760]120  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
121  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
[960fd85]122  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
123  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
[d60e760]124  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
[e4927ece]125  .rtemsroset : {
[c2395717]126    /* for pre rtems-libbsd FreeBSD code */
127    __start_set_sysctl_set = .;
[24a6943]128    KEEP(*(set_sysctl_*));
[c2395717]129    __stop_set_sysctl_set = .;
[24a6943]130    KEEP(*(set_domain_*));
131    KEEP(*(set_pseudo_*));
[c2395717]132
[e4927ece]133    KEEP (*(SORT(.rtemsroset.*)))
[c2395717]134
[aae7daa9]135    . = ALIGN (16);
136    _endtext = .;
[c2395717]137  } >ram
[c8941b0]138  .rela.dyn       :
139    {
140      *(.rela.init)
141      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
142      *(.rela.fini)
143      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
144      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
145      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
146      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
147      *(.rela.ctors)
148      *(.rela.dtors)
149      *(.rela.got)
150      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
151    } >ram
152  .data :
153  {
154    data_start = .;
155    _data_start = .;
156    _sdata = . ;
157    *(.data*)
158    *(.gnu.linkonce.d*)
[95cb09e]159    . = ALIGN(0x10);
[c8941b0]160    *(.gcc_except_table*)
161    . = ALIGN(0x10);
162    edata = .;
163    _edata = .;
164  } > ram
[fac8a3a]165  _data_load_start = LOADADDR (.data);
[91c250fc]166  .rtemsrwset : {
167    KEEP (*(SORT(.rtemsrwset.*)))
168  } >ram
[c8941b0]169  .dynamic        : { *(.dynamic)       } >ram
170  .jcr            : { *(.jcr)           } >ram
171  .got            : { *(.got)           } >ram
172  .plt            : { *(.plt)           } >ram
173  .hash           : { *(.hash)          } >ram
174  .dynrel         : { *(.dynrel)        } >ram
175  .dynsym         : { *(.dynsym)        } >ram
176  .dynstr         : { *(.dynstr)        } >ram
177  .hash           : { *(.hash)          } >ram
178  .shbss :
179  {
180    *(.shbss)
181  } > ram
182  .bss :
183  {
184    __bss_start = ALIGN(0x8);
185    _bss_start = .;
186    bss_start = .;
187    *(.bss .bss* .gnu.linkonce.b*)
188    *(COMMON)
189    . = ALIGN (16);
190    end = .;
191    _end = ALIGN(0x8);
192    __end = ALIGN(0x8);
193  } > ram
194  .stab . (NOLOAD) :
195  {
196    [ .stab ]
197  }
198  .stabstr . (NOLOAD) :
199  {
200    [ .stabstr ]
201  }
202}
Note: See TracBrowser for help on using the repository browser.