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

5
Last change on this file since 4899759 was 4899759, checked in by Thanassis Tsiodras <Thanassis.Tsiodras@…>, on Mar 6, 2018 at 6:23:07 AM

bsps/sparc: Fix global construction/destruction

The

KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))

cannot be simplified to

KEEP (*(SORT(.ctors*)))

since

.ctors < .ctors.*

in lexicographical order.

See spglobalcon02 test case.

Update #3319.

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