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

4.11
Last change on this file since 63c6b06f was 63c6b06f, checked in by Thanassis Tsiodras <Thanassis.Tsiodras@…>, on 03/06/18 at 06:23:07

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.

Close #3319.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*  linkcmds
2 */
3
4OUTPUT_ARCH(sparc)
5__DYNAMIC  =  0;
6ENTRY(start)
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
66    KEEP(*(.eh_frame*))
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))
90    KEEP (*(SORT(.ctors.*)))
91    KEEP (*(.ctors))
92    KEEP (*crtbegin.o(.dtors))
93    KEEP (*crtbegin?.o(.dtors))
94    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
95    KEEP (*(SORT(.dtors.*)))
96    KEEP (*(.dtors))
97
98    _rodata_start = . ;
99    *(.rodata*)
100    *(.gnu.linkonce.r*)
101    _erodata = ALIGN( 0x10 ) ;
102
103    etext = ALIGN(0x10);
104    _etext = .;
105    KEEP(*(.init*))
106    KEEP(*(.fini*))
107    *(.lit)
108    *(.shdata)
109    . = ALIGN (16);
110  } > ram
111  .tdata : {
112    _TLS_Data_begin = .;
113    *(.tdata .tdata.* .gnu.linkonce.td.*)
114    _TLS_Data_end = .;
115  } > ram
116  .tbss : {
117    _TLS_BSS_begin = .;
118    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
119    _TLS_BSS_end = .;
120  } > ram
121  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
122  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
123  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
124  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
125  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
126  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
127  .rtemsroset : {
128    /* for pre rtems-libbsd FreeBSD code */
129    __start_set_sysctl_set = .;
130    KEEP(*(set_sysctl_*));
131    __stop_set_sysctl_set = .;
132    KEEP(*(set_domain_*));
133    KEEP(*(set_pseudo_*));
134
135    KEEP (*(SORT(.rtemsroset.*)))
136
137    . = ALIGN (16);
138    _endtext = .;
139  } >ram
140  .rela.dyn       :
141    {
142      *(.rela.init)
143      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
144      *(.rela.fini)
145      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
146      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
147      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
148      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
149      *(.rela.ctors)
150      *(.rela.dtors)
151      *(.rela.got)
152      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
153    } >ram
154  .data :
155  {
156    data_start = .;
157    _data_start = .;
158    _sdata = . ;
159    *(.data*)
160    *(.gnu.linkonce.d*)
161    . = ALIGN(0x10);
162    *(.gcc_except_table*)
163    . = ALIGN(0x10);
164    edata = .;
165    _edata = .;
166  } > ram
167  .rtemsrwset : {
168    KEEP (*(SORT(.rtemsrwset.*)))
169  } >ram
170  .dynamic        : { *(.dynamic)       } >ram
171  .jcr            : { *(.jcr)           } >ram
172  .got            : { *(.got)           } >ram
173  .plt            : { *(.plt)           } >ram
174  .hash           : { *(.hash)          } >ram
175  .dynrel         : { *(.dynrel)        } >ram
176  .dynsym         : { *(.dynsym)        } >ram
177  .dynstr         : { *(.dynstr)        } >ram
178  .hash           : { *(.hash)          } >ram
179  .shbss :
180  {
181    *(.shbss)
182  } > ram
183  .bss :
184  {
185    __bss_start = ALIGN(0x8);
186    _bss_start = .;
187    bss_start = .;
188    *(.bss .bss* .gnu.linkonce.b*)
189    *(COMMON)
190    . = ALIGN (16);
191    end = .;
192    _end = ALIGN(0x8);
193    __end = ALIGN(0x8);
194  } > ram
195  .stab . (NOLOAD) :
196  {
197    [ .stab ]
198  }
199  .stabstr . (NOLOAD) :
200  {
201    [ .stabstr ]
202  }
203}
Note: See TracBrowser for help on using the repository browser.