source: rtems/c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds @ 0b344f34

4.115
Last change on this file since 0b344f34 was d60e760, checked in by Sebastian Huber <sebastian.huber@…>, on 04/22/14 at 07:45:39

bsps: Fix TLS support in linker command files

The TLS section symbols had wrong values in case of an empty TLS data
section and a nonempty TLS BSS section.

  • Property mode set to 100644
File size: 9.2 KB
Line 
1/*
2 * Declare some sizes.
3 */
4RamBase = DEFINED(RamBase) ? RamBase : 0x000000;
5RamSize = DEFINED(RamSize) ? RamSize : 0x800000;
6HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
7StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
8
9
10/* Default linker script, for normal executables */
11OUTPUT_FORMAT("elf32-m32r", "elf32-m32r",
12              "elf32-m32r")
13OUTPUT_ARCH(m32r)
14ENTRY(_start)
15SEARCH_DIR("/home/joel/work-gnat/svn/m32r-install/m32r-elf/lib");
16SECTIONS
17{
18  /* Read-only sections, merged into text segment: */
19  PROVIDE (__executable_start = 0x100); . = 0x100;
20  .interp         : { *(.interp) }
21  .note.gnu.build-id : { *(.note.gnu.build-id) }
22  .hash           : { *(.hash) }
23  .gnu.hash       : { *(.gnu.hash) }
24  .dynsym         : { *(.dynsym) }
25  .dynstr         : { *(.dynstr) }
26  .gnu.version    : { *(.gnu.version) }
27  .gnu.version_d  : { *(.gnu.version_d) }
28  .gnu.version_r  : { *(.gnu.version_r) }
29  .rel.init       : { *(.rel.init) }
30  .rela.init      : { *(.rela.init) }
31  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
32  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
33  .rel.fini       : { *(.rel.fini) }
34  .rela.fini      : { *(.rela.fini) }
35  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
36  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
37  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
38  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
39  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
40  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
41  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
42  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
43  .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
44  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
45  .rel.ctors      : { *(.rel.ctors) }
46  .rela.ctors     : { *(.rela.ctors) }
47  .rel.dtors      : { *(.rel.dtors) }
48  .rela.dtors     : { *(.rela.dtors) }
49  .rel.got        : { *(.rel.got) }
50  .rela.got       : { *(.rela.got) }
51  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
52  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
53  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
54  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
55  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
56  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
57  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
58  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
59  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
60  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
61  .rel.plt        : { *(.rel.plt) }
62  .rela.plt       : { *(.rela.plt) }
63  .init           :
64  {
65    KEEP (*(.init))
66  } =0
67  .plt            : { *(.plt) }
68  .text           :
69  {
70    *(.text .stub .text.* .gnu.linkonce.t.*)
71    /* .gnu.warning sections are handled specially by elf32.em.  */
72    *(.gnu.warning)
73  } =0
74  .fini           :
75  {
76    KEEP (*(.fini))
77  } =0
78  PROVIDE (__etext = .);
79  PROVIDE (_etext = .);
80  PROVIDE (etext = .);
81  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
82  .rodata1        : { *(.rodata1) }
83  .tdata : {
84    _TLS_Data_begin = .;
85    *(.tdata .tdata.* .gnu.linkonce.td.*)
86    _TLS_Data_end = .;
87  }
88  .tbss : {
89    _TLS_BSS_begin = .;
90    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
91    _TLS_BSS_end = .;
92  }
93  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
94  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
95  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
96  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
97  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
98  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
99  .sdata2         :
100  {
101    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
102  }
103  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
104  .eh_frame_hdr : { *(.eh_frame_hdr) }
105  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
106  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
107  /* Adjust the address for the data segment.  We want to adjust up to
108     the same address within the page on the next page up.  */
109  . = ALIGN(32) + (. & (32 - 1));
110  /* Exception handling  */
111  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
112  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
113  /* Thread Local Storage sections  */
114  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
115  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
116  .preinit_array     :
117  {
118    PROVIDE_HIDDEN (__preinit_array_start = .);
119    KEEP (*(.preinit_array))
120    PROVIDE_HIDDEN (__preinit_array_end = .);
121  }
122  .init_array     :
123  {
124     PROVIDE_HIDDEN (__init_array_start = .);
125     KEEP (*(SORT(.init_array.*)))
126     KEEP (*(.init_array))
127     PROVIDE_HIDDEN (__init_array_end = .);
128  }
129  .fini_array     :
130  {
131    PROVIDE_HIDDEN (__fini_array_start = .);
132    KEEP (*(.fini_array))
133    KEEP (*(SORT(.fini_array.*)))
134    PROVIDE_HIDDEN (__fini_array_end = .);
135  }
136  .ctors          :
137  {
138    /* gcc uses crtbegin.o to find the start of
139       the constructors, so we make sure it is
140       first.  Because this is a wildcard, it
141       doesn't matter if the user does not
142       actually link against crtbegin.o; the
143       linker won't look for a file to match a
144       wildcard.  The wildcard also means that it
145       doesn't matter which directory crtbegin.o
146       is in.  */
147    KEEP (*crtbegin.o(.ctors))
148    KEEP (*crtbegin?.o(.ctors))
149    /* We don't want to include the .ctor section from
150       the crtend.o file until after the sorted ctors.
151       The .ctor section from the crtend file contains the
152       end of ctors marker and it must be last */
153    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
154    KEEP (*(SORT(.ctors.*)))
155    KEEP (*(.ctors))
156  }
157  .dtors          :
158  {
159    KEEP (*crtbegin.o(.dtors))
160    KEEP (*crtbegin?.o(.dtors))
161    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
162    KEEP (*(SORT(.dtors.*)))
163    KEEP (*(.dtors))
164  }
165  .jcr            : { KEEP (*(.jcr)) }
166  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
167  .dynamic        : { *(.dynamic) }
168  .data           :
169  {
170    *(.data .data.* .gnu.linkonce.d.*)
171    SORT(CONSTRUCTORS)
172  }
173  .data1          : { *(.data1) }
174  .got            : { *(.got.plt) *(.got) }
175  /* We want the small data sections together, so single-instruction offsets
176     can access them all, and initialized data all before uninitialized, so
177     we can shorten the on-disk segment size.  */
178  .sdata          :
179  {
180    *(.sdata .sdata.* .gnu.linkonce.s.*)
181  }
182  _edata = .; PROVIDE (edata = .);
183  __bss_start = .;
184  .sbss           :
185  {
186    *(.dynsbss)
187    *(.sbss .sbss.* .gnu.linkonce.sb.*)
188    *(.scommon)
189  }
190  .bss            :
191  {
192   *(.dynbss)
193   *(.bss .bss.* .gnu.linkonce.b.*)
194   *(COMMON)
195   /* Align here to ensure that the .bss section occupies space up to
196      _end.  Align after .bss to ensure correct alignment even if the
197      .bss section disappears because there are no input sections.
198      FIXME: Why do we need it? When there is no .bss section, we don't
199      pad the .data section.  */
200   . = ALIGN(. != 0 ? 32 / 8 : 1);
201  }
202  . = ALIGN(32 / 8);
203  . = ALIGN(32 / 8);
204  _end = .; PROVIDE (end = .);
205  . = ALIGN(16);
206
207  . += StackSize;
208  PROVIDE (_stack = .);
209  PROVIDE (WorkAreaBase = .);
210  .  = 0x800000;
211  /* Stabs debugging sections.  */
212  .stab          0 : { *(.stab) }
213  .stabstr       0 : { *(.stabstr) }
214  .stab.excl     0 : { *(.stab.excl) }
215  .stab.exclstr  0 : { *(.stab.exclstr) }
216  .stab.index    0 : { *(.stab.index) }
217  .stab.indexstr 0 : { *(.stab.indexstr) }
218  .comment       0 : { *(.comment) }
219  /* DWARF debug sections.
220     Symbols in the DWARF debugging sections are relative to the beginning
221     of the section so we begin them at 0.  */
222  /* DWARF 1 */
223  .debug          0 : { *(.debug) }
224  .line           0 : { *(.line) }
225  /* GNU DWARF 1 extensions */
226  .debug_srcinfo  0 : { *(.debug_srcinfo) }
227  .debug_sfnames  0 : { *(.debug_sfnames) }
228  /* DWARF 1.1 and DWARF 2 */
229  .debug_aranges  0 : { *(.debug_aranges) }
230  .debug_pubnames 0 : { *(.debug_pubnames) }
231  /* DWARF 2 */
232  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
233  .debug_abbrev   0 : { *(.debug_abbrev) }
234  .debug_line     0 : { *(.debug_line) }
235  .debug_frame    0 : { *(.debug_frame) }
236  .debug_str      0 : { *(.debug_str) }
237  .debug_loc      0 : { *(.debug_loc) }
238  .debug_macinfo  0 : { *(.debug_macinfo) }
239  /* SGI/MIPS DWARF 2 extensions */
240  .debug_weaknames 0 : { *(.debug_weaknames) }
241  .debug_funcnames 0 : { *(.debug_funcnames) }
242  .debug_typenames 0 : { *(.debug_typenames) }
243  .debug_varnames  0 : { *(.debug_varnames) }
244  /* DWARF 3 */
245  .debug_pubtypes 0 : { *(.debug_pubtypes) }
246  .debug_ranges   0 : { *(.debug_ranges) }
247  /* DWARF extension */
248  .debug_macro    0 : { *(.debug_macro) }
249  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
250  /* PROVIDE (_stack = 0x800000); */
251  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
252}
Note: See TracBrowser for help on using the repository browser.