source: rtems/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds @ 5139d21

4.115
Last change on this file since 5139d21 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: 7.6 KB
RevLine 
[032e5e4]1/*
2 * The common part of the default linker scripts for standalone
3 * executables running on a Moxie processor.
4 *
5 * Copyright (C) 2008 Anthony Green
6 *
7 * The authors hereby grant permission to use, copy, modify,
8 * distribute, and license this software and its documentation for any
9 * purpose, provided that existing copyright notices are retained in
10 * all copies and that this notice is included verbatim in any
11 * distributions. No written agreement, license, or royalty fee is
12 * required for any of the authorized uses. Modifications to this
13 * software may be copyrighted by their authors and need not follow
14 * the licensing terms described here, provided that the new terms are
15 * clearly indicated on the first page of each file where they apply.
16 */
17
18OUTPUT_FORMAT("elf32-bigmoxie")
19OUTPUT_ARCH(moxie)
20ENTRY(_start)
21
22RamBase = DEFINED(RamBase) ? RamBase : 0x00000000;
23RamSize = DEFINED(RamSize) ? RamSize : 16M;
24HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
25
26SECTIONS
27{
28  /* Read-only sections, merged into text segment: */
29  . = 0x00001000;
30  .interp     : { *(.interp)    }
31  .hash          : { *(.hash)           }
32  .dynsym        : { *(.dynsym)         }
33  .dynstr        : { *(.dynstr)         }
34  .gnu.version   : { *(.gnu.version)    }
35  .gnu.version_d   : { *(.gnu.version_d)        }
36  .gnu.version_r   : { *(.gnu.version_r)        }
37  .rel.init      : { *(.rel.init)       }
38  .rela.init     : { *(.rela.init)      }
39  .rel.text      :
40    {
41      *(.rel.text)
42      *(.rel.text.*)
43      *(.rel.gnu.linkonce.t*)
44    }
45  .rela.text     :
46    {
47      *(.rela.text)
48      *(.rela.text.*)
49      *(.rela.gnu.linkonce.t*)
50    }
51  .rel.fini      : { *(.rel.fini)       }
52  .rela.fini     : { *(.rela.fini)      }
53  .rel.rodata    :
54    {
55      *(.rel.rodata)
56      *(.rel.rodata.*)
57      *(.rel.gnu.linkonce.r*)
58    }
59  .rela.rodata   :
60    {
61      *(.rela.rodata)
62      *(.rela.rodata.*)
63      *(.rela.gnu.linkonce.r*)
64    }
65  .rel.data      :
66    {
67      *(.rel.data)
68      *(.rel.data.*)
69      *(.rel.gnu.linkonce.d*)
70    }
71  .rela.data     :
72    {
73      *(.rela.data)
74      *(.rela.data.*)
75      *(.rela.gnu.linkonce.d*)
76    }
77  .rel.ctors     : { *(.rel.ctors)      }
78  .rela.ctors    : { *(.rela.ctors)     }
79  .rel.dtors     : { *(.rel.dtors)      }
80  .rela.dtors    : { *(.rela.dtors)     }
81  .rel.got       : { *(.rel.got)                }
82  .rela.got      : { *(.rela.got)               }
83  .rel.sdata     :
84    {
85      *(.rel.sdata)
86      *(.rel.sdata.*)
87      *(.rel.gnu.linkonce.s*)
88    }
89  .rela.sdata     :
90    {
91      *(.rela.sdata)
92      *(.rela.sdata.*)
93      *(.rela.gnu.linkonce.s*)
94    }
95  .rel.sbss      : { *(.rel.sbss)               }
96  .rela.sbss     : { *(.rela.sbss)      }
97  .rel.bss       : { *(.rel.bss)                }
98  .rela.bss      : { *(.rela.bss)               }
99  .rel.plt       : { *(.rel.plt)                }
100  .rela.plt      : { *(.rela.plt)               }
101  .plt      : { *(.plt) }
102  .text      :
103  {
104    *(.text)
105    *(.text.*)
106    *(.stub)
107
108    /*
109     * Special FreeBSD sysctl sections.
110     */
111    . = ALIGN (16);
112    __start_set_sysctl_set = .;
113    *(set_sysctl_*);
114    __stop_set_sysctl_set = ABSOLUTE(.);
115    *(set_domain_*);
116    *(set_pseudo_*);
117
118    /* .gnu.warning sections are handled specially by elf32.em.  */
119    *(.gnu.warning)
120    *(.gnu.linkonce.t*)
121    *(.glue_7t) *(.glue_7)
122  } =0
123  .init          :
124  {
125    KEEP (*(.init))
126  } =0
127  _etext = .;
128  PROVIDE (etext = .);
129  .fini      :
130  {
131    KEEP (*(.fini))
132  } =0
133  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
134  .rodata1   : { *(.rodata1) }
[960fd85]135  .tdata : {
136    _TLS_Data_begin = .;
137    *(.tdata .tdata.* .gnu.linkonce.td.*)
138    _TLS_Data_end = .;
139  }
140  .tbss : {
141    _TLS_BSS_begin = .;
142    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
143    _TLS_BSS_end = .;
144  }
145  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
[d60e760]146  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
147  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
[960fd85]148  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
149  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
[d60e760]150  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
[032e5e4]151  .eh_frame_hdr : { *(.eh_frame_hdr) }
152  /* Adjust the address for the data segment.  We want to adjust up to
153     the same address within the page on the next page up.  */
154  . = ALIGN(256) + (. & (256 - 1));
155  .data    :
156  {
157    *(.data)
158    *(.data.*)
159    *(.gnu.linkonce.d*)
160    SORT(CONSTRUCTORS)
161  }
162  .data1   : { *(.data1) }
163  .eh_frame : { KEEP (*(.eh_frame)) }
164  .gcc_except_table : { *(.gcc_except_table) }
165  .ctors   :
166  {
167    /* gcc uses crtbegin.o to find the start of
168       the constructors, so we make sure it is
169       first.  Because this is a wildcard, it
170       doesn't matter if the user does not
171       actually link against crtbegin.o; the
172       linker won't look for a file to match a
173       wildcard.  The wildcard also means that it
174       doesn't matter which directory crtbegin.o
175       is in.  */
176    KEEP (*crtbegin.o(.ctors))
177    /* We don't want to include the .ctor section from
178       from the crtend.o file until after the sorted ctors.
179       The .ctor section from the crtend file contains the
180       end of ctors marker and it must be last */
181    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
182    KEEP (*(SORT(.ctors.*)))
183    KEEP (*(.ctors))
184  }
185   .dtors         :
186  {
187    KEEP (*crtbegin.o(.dtors))
188    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
189    KEEP (*(SORT(.dtors.*)))
190    KEEP (*(.dtors))
191  }
192  .jcr            : { KEEP (*(.jcr)) }
193  .got           : { *(.got.plt) *(.got) }
194  .dynamic       : { *(.dynamic) }
195  /* We want the small data sections together, so single-instruction offsets
196     can access them all, and initialized data all before uninitialized, so
197     we can shorten the on-disk segment size.  */
198  .sdata     :
199  {
200    *(.sdata)
201    *(.sdata.*)
202    *(.gnu.linkonce.s.*)
203  }
204  _edata = .;
205  PROVIDE (edata = .);
206  __bss_start = .;
207  __bss_start__ = .;
208  .sbss      :
209  {
210    *(.dynsbss)
211    *(.sbss)
212    *(.sbss.*)
213    *(.scommon)
214  }
215  .bss       :
216  {
217   *(.dynbss)
218   *(.bss)
219   *(.bss.*)
220   *(COMMON)
221   /* Align here to ensure that the .bss section occupies space up to
222      _end.  Align after .bss to ensure correct alignment even if the
223      .bss section disappears because there are no input sections.  */
224   . = ALIGN(32 / 8);
225  }
226  . = ALIGN(32 / 8);
227  _end = .;
228  _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
229  PROVIDE (end = .);
230  WorkAreaBase = .;
231  /* Stabs debugging sections.  */
232  .stab 0 : { *(.stab) }
233  .stabstr 0 : { *(.stabstr) }
234  .stab.excl 0 : { *(.stab.excl) }
235  .stab.exclstr 0 : { *(.stab.exclstr) }
236  .stab.index 0 : { *(.stab.index) }
237  .stab.indexstr 0 : { *(.stab.indexstr) }
238  .comment 0 : { *(.comment) }
239  /* DWARF debug sections.
240     Symbols in the DWARF debugging sections are relative to the beginning
241     of the section so we begin them at 0.  */
242  /* DWARF 1 */
243  .debug          0 : { *(.debug) }
244  .line           0 : { *(.line) }
245  /* GNU DWARF 1 extensions */
246  .debug_srcinfo  0 : { *(.debug_srcinfo) }
247  .debug_sfnames  0 : { *(.debug_sfnames) }
248  /* DWARF 1.1 and DWARF 2 */
249  .debug_aranges  0 : { *(.debug_aranges) }
250  .debug_pubnames 0 : { *(.debug_pubnames) }
251  /* DWARF 2 */
252  .debug_info     0 : { *(.debug_info) }
253  .debug_abbrev   0 : { *(.debug_abbrev) }
254  .debug_line     0 : { *(.debug_line) }
255  .debug_frame    0 : { *(.debug_frame) }
256  .debug_str      0 : { *(.debug_str) }
257  .debug_loc      0 : { *(.debug_loc) }
258  .debug_macinfo  0 : { *(.debug_macinfo) }
259  .debug_ranges   0 : { *(.debug_ranges) }
260  /* SGI/MIPS DWARF 2 extensions */
261  .debug_weaknames 0 : { *(.debug_weaknames) }
262  .debug_funcnames 0 : { *(.debug_funcnames) }
263  .debug_typenames 0 : { *(.debug_typenames) }
264  .debug_varnames  0 : { *(.debug_varnames) }
265  .stack 0x400000 : { _stack = .; *(.stack) }
266  /* These must appear regardless of  .  */
267}
Note: See TracBrowser for help on using the repository browser.