source: rtems/c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds @ d60e760

4.115
Last change on this file since d60e760 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: 8.7 KB
Line 
1OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
2              "elf32-powerpc")
3OUTPUT_ARCH(powerpc)
4ENTRY(_start)
5/* Do we need any of these for elf?
6   __DYNAMIC = 0;    */
7PROVIDE (__stack = 0);
8
9
10MEMORY {
11    BOTTOM  : ORIGIN = 0x00,    LENGTH = 0x80
12    MAILBOX : ORIGIN = 0x80,    LENGTH = 0x80   /* RESERVED */
13        VECTORS : ORIGIN = 0x100 ,  LENGTH = 0x3000 - 0x100
14        CODE : ORIGIN = 0x3000 , LENGTH = 32M-0x3000
15}
16SECTIONS
17{
18  /* discard the 'shared/vector.S' entry point section */
19  /DISCARD/ :
20  {
21        *(.entry_point_section)
22  }
23
24
25  .vectors :
26  {
27        /* should be the first thing... */
28        *(.ppc_preloader_section)
29
30   /*
31    * This section is used only if NO_DYNAMIC_EXCEPTION_VECTOR_INSTALL
32    * is defined in vectors/vectors.S
33    *  *(.vectors)
34    * We actually RELY on dynamic vector installation since we need
35    * this space for the preloader...
36    */
37  } > VECTORS
38
39
40  /* START OF THE LOADED IMAGE (parts moved by the preloader) */
41  .image_start :
42  {
43        __rtems_start = ABSOLUTE(.);
44  } > CODE
45
46  /* Read-only sections, merged into text segment: */
47  .interp   : { *(.interp) }    > CODE
48  .hash           : { *(.hash)          }       > CODE
49  .dynsym         : { *(.dynsym)                }       > CODE
50  .dynstr         : { *(.dynstr)                }       > CODE
51  .gnu.version   : { *(.gnu.version)      }     > CODE
52  .gnu.version_d   : { *(.gnu.version_d)  }     > CODE
53  .gnu.version_r   : { *(.gnu.version_r)  }     > CODE
54  .rela.text     :
55    { *(.rela.text) *(.rela.gnu.linkonce.t*) }  > CODE
56  .rela.data     :
57    { *(.rela.data) *(.rela.gnu.linkonce.d*) }  > CODE
58  .rela.rodata   :
59    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }        > CODE
60  .rela.got       : { *(.rela.got)      }       > CODE
61  .rela.got1      : { *(.rela.got1)     }       > CODE
62  .rela.got2      : { *(.rela.got2)     }       > CODE
63  .rela.ctors     : { *(.rela.ctors)    }       > CODE
64  .rela.dtors     : { *(.rela.dtors)    }       > CODE
65  .rela.init      : { *(.rela.init)     }       > CODE
66  .rela.fini      : { *(.rela.fini)     }       > CODE
67  .rela.bss       : { *(.rela.bss)      }       > CODE
68  .rela.plt       : { *(.rela.plt)      }       > CODE
69  .rela.sdata     : { *(.rela.sdata)    }       > CODE
70  .rela.sbss      : { *(.rela.sbss)     }       > CODE
71  .rela.sdata2    : { *(.rela.sdata2)   }       > CODE
72  .rela.sbss2     : { *(.rela.sbss2)    }       > CODE
73
74  .init                   : { *(.init)                  } >CODE
75
76  .text      : 
77  {
78    *(.text*)   
79 
80    /*
81     * Special FreeBSD sysctl sections.
82     */
83    . = ALIGN (16);
84    __start_set_sysctl_set = .;
85    *(set_sysctl_*);
86    __stop_set_sysctl_set = ABSOLUTE(.);
87    *(set_domain_*);
88    *(set_pseudo_*);
89 
90   /* .gnu.warning sections are handled specially by elf32.em.  */
91    *(.gnu.warning)
92    *(.gnu.linkonce.t*)
93  }  > CODE
94
95  .fini                   : { _fini = .; *(.fini)       } >CODE
96  .rodata         : { *(.rodata*) *(.gnu.linkonce.r*) } > CODE
97  .rodata1        : { *(.rodata1) }     > CODE
98  .tdata : {
99    _TLS_Data_begin = .;
100    *(.tdata .tdata.* .gnu.linkonce.td.*)
101    _TLS_Data_end = .;
102  } >CODE
103  .tbss : {
104    _TLS_BSS_begin = .;
105    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
106    _TLS_BSS_end = .;
107  } >CODE
108  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
109  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
110  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
111  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
112  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
113  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
114  .sdata2         : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2) *(.gnu.linkonce.s2.*)  }        > CODE
115  .sbss2          : {
116                                PROVIDE (__sbss2_start = .);
117                                          *(.sbss2*) *(.gnu.linkonce.sb2.*)
118                                          /* avoid empty sdata2/sbss2 area because __eabi wouldn't set up r2
119                                           * (IMPORTANT if run-time loading is involved)
120                                           */
121                                          . += 1 ;
122                                PROVIDE (__sbss2_end = .);
123                                        }       > CODE
124  .eh_frame           : { *.(eh_frame)          } >CODE
125  _etext = .;
126  PROVIDE (etext = .);
127  /* Adjust the address for the data segment.  We want to adjust up to
128     the same address within the page on the next page up.  It would
129     be more correct to do this:
130       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
131     The current expression does not correctly handle the case of a
132     text segment ending precisely at the end of a page; it causes the
133     data segment to skip a page.  The above expression does not have
134     this problem, but it will currently (2/95) cause BFD to allocate
135     a single segment, combining both text and data, for this case.
136     This will prevent the text segment from being shared among
137     multiple executions of the program; I think that is more
138     important than losing a page of the virtual address space (note
139     that no actual memory is lost; the page which is skipped can not
140     be referenced).  */
141 .data  ALIGN(0x1000)  :
142  {
143        PROVIDE(__DATA_START__ = ABSOLUTE(.) );
144    *(.data)
145    *(.gnu.linkonce.d*)
146    CONSTRUCTORS
147  } > CODE
148  .data1   : { *(.data1) }      > CODE
149  PROVIDE (__EXCEPT_START__ = .);
150  .gcc_except_table   : { *(.gcc_except_table) } > CODE
151  PROVIDE (__EXCEPT_END__ = .);
152  .got1           : { *(.got1) }        > CODE
153  .dynamic        : { *(.dynamic) }     > CODE
154  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
155     get relocated with -mrelocatable. Also put in the .fixup pointers.
156     The current compiler no longer needs this, but keep it around for 2.7.2  */
157                PROVIDE (_GOT2_START_ = .);
158  .got2           :  { *(.got2) }       > CODE
159/*
160                PROVIDE (__CTOR_LIST__ = .);
161  .ctors          : { *(.ctors) }       > CODE
162                PROVIDE (__CTOR_END__ = .);
163*/
164  .ctors :
165  {
166    KEEP(*crtbegin.o(.ctors))
167    KEEP(*(EXCLUDE_FILE(*crtend.o) .ctors))
168    KEEP(*(SORT(.ctors.*)))
169    KEEP(*(.ctors))
170  } > CODE
171  .dtors :
172  {
173    KEEP(*crtbegin.o(.dtors))
174    KEEP(*(EXCLUDE_FILE(*crtend.o) .dtors))
175    KEEP(*(SORT(.dtors.*)))
176    KEEP(*(.dtors))
177  } > CODE
178/*
179                PROVIDE (__DTOR_LIST__ = .);
180  .dtors          : { *(.dtors) }       > CODE
181                PROVIDE (__DTOR_END__ = .);
182*/
183                PROVIDE (_FIXUP_START_ = .);
184  .fixup          : { *(.fixup) }       > CODE
185                PROVIDE (_FIXUP_END_ = .);
186                PROVIDE (_GOT2_END_ = .);
187                PROVIDE (_GOT_START_ = .);
188  .got            : { *(.got) } > CODE
189  .got.plt        : { *(.got.plt) }     > CODE
190                PROVIDE (_GOT_END_ = .);
191
192  .jcr            : { KEEP (*(.jcr)) } > CODE
193
194  /* We want the small data sections together, so single-instruction offsets
195     can access them all, and initialized data all before uninitialized, so
196     we can shorten the on-disk segment size.  */
197  .sdata          : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata*) *(.gnu.linkonce.s.*) }   > CODE
198  _edata  =  .;
199  PROVIDE (edata = .);
200/* END OF THE LOADED IMAGE (parts moved by the preloader) */
201/* BELOW THIS POINT, NO LOADABLE ITEMS MUST APPEAR */
202  .sbss      :
203  {
204    PROVIDE (__sbss_start = ABSOLUTE(.));
205    *(.sbss) *(.sbss.*) *(.gnu.linkonce.sb.*)
206    *(.scommon)
207    *(.dynsbss)
208        /* avoid empty sdata/sbss area because __eabi wouldn't set up r13
209         * (IMPORTANT if run-time loading is involved)
210         */
211        . += 1 ;
212    PROVIDE (__sbss_end = ABSOLUTE(.));
213  } > CODE
214  .plt   : { *(.plt) }  > CODE
215  .bss       :
216  {
217   PROVIDE (__bss_start = ABSOLUTE(.));
218   *(.dynbss)
219   *(.bss*) *(.gnu.linkonce.b.*)
220   *(COMMON)
221  . = ALIGN(16);
222  } > CODE
223  /* proper alignment for SYSV stack
224   * (init stack is allocated just after __rtems_end
225   */
226  . = ALIGN(16);
227  _end = . ;
228  __rtems_end = . ;
229  PROVIDE (end = .);
230  /DISCARD/ :
231  {
232    *(.comment)
233  }
234
235
236  /* Stabs debugging sections.  */
237  .stab 0 : { *(.stab) }
238  .stabstr 0 : { *(.stabstr) }
239  .stab.excl 0 : { *(.stab.excl) }
240  .stab.exclstr 0 : { *(.stab.exclstr) }
241  .stab.index 0 : { *(.stab.index) }
242  .stab.indexstr 0 : { *(.stab.indexstr) }
243  .comment 0 : { *(.comment) }
244
245  /* DWARF debug sections.
246     Symbols in the DWARF debugging sections are relative to the beginning
247     of the section so we begin them at 0.  */
248  /* DWARF 1 */
249  .debug          0 : { *(.debug) }
250  .line           0 : { *(.line) }
251 
252  /* GNU DWARF 1 extensions */
253  .debug_srcinfo  0 : { *(.debug_srcinfo) }
254  .debug_sfnames  0 : { *(.debug_sfnames) }
255 
256  /* DWARF 1.1 and DWARF 2 */
257  .debug_aranges  0 : { *(.debug_aranges) }
258  .debug_pubnames 0 : { *(.debug_pubnames) }
259 
260  /* DWARF 2 */
261  .debug_info     0 : { *(.debug_info) }
262  .debug_abbrev   0 : { *(.debug_abbrev) }
263  .debug_line     0 : { *(.debug_line) }
264  .debug_frame    0 : { *(.debug_frame) }
265  .debug_str      0 : { *(.debug_str) }
266  .debug_loc      0 : { *(.debug_loc) }
267  .debug_macinfo  0 : { *(.debug_macinfo) }
268 
269  /* SGI/MIPS DWARF 2 extensions */
270  .debug_weaknames 0 : { *(.debug_weaknames) }
271  .debug_funcnames 0 : { *(.debug_funcnames) }
272  .debug_typenames 0 : { *(.debug_typenames) }
273  .debug_varnames  0 : { *(.debug_varnames) }
274  /* These must appear regardless of  .  */
275}
Note: See TracBrowser for help on using the repository browser.