source: rtems/c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds @ 5d81ce9

4.104.114.84.95
Last change on this file since 5d81ce9 was 5d81ce9, checked in by Joel Sherrill <joel.sherrill@…>, on 11/18/02 at 00:52:17

2002-11-14 Greg Menke <gregory.menke@…>

  • bsp_specs: Added crtbegin,crtend objects so C++ global objects constructors/destructors run correctly.
  • startup/linkcmds: Increased code length and updated the ctor/dtor sections to handle crtbegin, crtend objects.
  • Property mode set to 100644
File size: 8.2 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);
8MEMORY {
9        VECTORS : ORIGIN = 0x0 ,  LENGTH = 0x3000
10        CODE : ORIGIN = 0x3000 , LENGTH = 0x200000
11}
12SECTIONS
13{
14  .entry_point_section :
15  {
16        *(.entry_point_section)
17  } > VECTORS
18
19  /*
20   * This section is used only if NO_DYNAMIC_EXCEPTION_VECTOR_INSTALL
21   * is defined in vectors/vectors.S
22   */
23  .vectors :
24  {
25    *(.vectors)
26  } > VECTORS
27
28  /* Read-only sections, merged into text segment: */
29  .interp   : { *(.interp) }    > CODE
30  .hash           : { *(.hash)          }       > CODE
31  .dynsym         : { *(.dynsym)                }       > CODE
32  .dynstr         : { *(.dynstr)                }       > CODE
33  .gnu.version   : { *(.gnu.version)      }     > CODE
34  .gnu.version_d   : { *(.gnu.version_d)  }     > CODE
35  .gnu.version_r   : { *(.gnu.version_r)  }     > CODE
36  .rela.text     :
37    { *(.rela.text) *(.rela.gnu.linkonce.t*) }  > CODE
38  .rela.data     :
39    { *(.rela.data) *(.rela.gnu.linkonce.d*) }  > CODE
40  .rela.rodata   :
41    { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) }       > CODE
42  .rela.got       : { *(.rela.got)      }       > CODE
43  .rela.got1      : { *(.rela.got1)     }       > CODE
44  .rela.got2      : { *(.rela.got2)     }       > CODE
45  .rela.ctors     : { *(.rela.ctors)    }       > CODE
46  .rela.dtors     : { *(.rela.dtors)    }       > CODE
47  .rela.init      : { *(.rela.init)     }       > CODE
48  .rela.fini      : { *(.rela.fini)     }       > CODE
49  .rela.bss       : { *(.rela.bss)      }       > CODE
50  .rela.plt       : { *(.rela.plt)      }       > CODE
51  .rela.sdata     : { *(.rela.sdata)    }       > CODE
52  .rela.sbss      : { *(.rela.sbss)     }       > CODE
53  .rela.sdata2    : { *(.rela.sdata2)   }       > CODE
54  .rela.sbss2     : { *(.rela.sbss2)    }       > CODE
55  .text      : 
56  {
57    *(.text)   
58    /* .gnu.warning sections are handled specially by elf32.em.  */
59    *(.gnu.warning)
60    *(.gnu.linkonce.t*)
61  }  > CODE
62  .init           : { _init = .; KEEP(*(.init)) } >CODE
63  .fini           : { _fini = .; KEEP(*(.fini)) } >CODE
64  .rodata         : { *(.rodata*) *(.gnu.linkonce.r*) } > CODE
65  .rodata1        : { *(.rodata1) }     > CODE
66  .eh_frame       : { *.(eh_frame)              } >CODE
67  _etext = .;
68  PROVIDE (etext = .);
69
70  /* Adjust the address for the data segment.  We want to adjust up to
71     the same address within the page on the next page up.  */
72  . = ALIGN(0x10000) + (. & (0x10000 - 1));
73  /* Ensure the __preinit_array_start label is properly aligned.  We
74     could instead move the label definition inside the section, but
75     the linker would then create the section even if it turns out to
76     be empty, which isn't pretty.  */
77  . = ALIGN(32 / 8);
78  PROVIDE (__preinit_array_start = .);
79  .preinit_array     : { *(.preinit_array) } >CODE
80  PROVIDE (__preinit_array_end = .);
81  PROVIDE (__init_array_start = .);
82  .init_array     : { *(.init_array) } >CODE
83  PROVIDE (__init_array_end = .);
84  PROVIDE (__fini_array_start = .);
85  .fini_array     : { *(.fini_array) } >CODE
86  PROVIDE (__fini_array_end = .);
87
88  .sdata2         : { *(.sdata2) *(.gnu.linkonce.s2.*)  } >CODE
89  .sbss2          : { *(.sbss2) *(.gnu.linkonce.sb2.*)  } >CODE
90  /* Adjust the address for the data segment.  We want to adjust up to
91     the same address within the page on the next page up.  It would
92     be more correct to do this:
93       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
94     The current expression does not correctly handle the case of a
95     text segment ending precisely at the end of a page; it causes the
96     data segment to skip a page.  The above expression does not have
97     this problem, but it will currently (2/95) cause BFD to allocate
98     a single segment, combining both text and data, for this case.
99     This will prevent the text segment from being shared among
100     multiple executions of the program; I think that is more
101     important than losing a page of the virtual address space (note
102     that no actual memory is lost; the page which is skipped can not
103     be referenced).  */
104  . = ALIGN(0x1000);
105 .data    :
106  {
107    *(.data)
108    *(.gnu.linkonce.d*)
109    SORT(CONSTRUCTORS)
110  } > CODE
111  .data1   : { *(.data1) }      > CODE
112  PROVIDE (__EXCEPT_START__ = .);
113  .gcc_except_table   : { *(.gcc_except_table) } > CODE
114  PROVIDE (__EXCEPT_END__ = .);
115  .got1           : { *(.got1) }        > CODE
116  .dynamic        : { *(.dynamic) }     > CODE
117  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
118     get relocated with -mrelocatable. Also put in the .fixup pointers.
119     The current compiler no longer needs this, but keep it around for 2.7.2  */
120                PROVIDE (_GOT2_START_ = .);
121  .got2           :  { *(.got2) }       > CODE
122
123
124/* removed 11/14, gregm
125                PROVIDE (__CTOR_LIST__ = .);
126  .ctors          : { *(.ctors) }       > CODE
127                PROVIDE (__CTOR_END__ = .);
128                PROVIDE (__DTOR_LIST__ = .);
129  .dtors          : { *(.dtors) }       > CODE
130                PROVIDE (__DTOR_END__ = .);
131*/
132
133
134  .ctors          :
135  {
136    /* gcc uses crtbegin.o to find the start of
137       the constructors, so we make sure it is
138       first.  Because this is a wildcard, it
139       doesn't matter if the user does not
140       actually link against crtbegin.o; the
141       linker won't look for a file to match a
142       wildcard.  The wildcard also means that it
143       doesn't matter which directory crtbegin.o
144       is in.  */
145    KEEP (*crtbegin.o(.ctors))
146    /* We don't want to include the .ctor section from
147       from the crtend.o file until after the sorted ctors.
148       The .ctor section from the crtend file contains the
149       end of ctors marker and it must be last */
150    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
151    KEEP (*(SORT(.ctors.*)))
152    KEEP (*(.ctors))
153  } > CODE
154  .dtors          :
155  {
156    KEEP (*crtbegin.o(.dtors))
157    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
158    KEEP (*(SORT(.dtors.*)))
159    KEEP (*(.dtors))
160  } > CODE
161
162
163                PROVIDE (_FIXUP_START_ = .);
164  .fixup          : { *(.fixup) }       > CODE
165                PROVIDE (_FIXUP_END_ = .);
166                PROVIDE (_GOT2_END_ = .);
167                PROVIDE (_GOT_START_ = .);
168
169  .got            : { *(.got) } > CODE
170  .got.plt        : { *(.got.plt) }     > CODE
171
172                PROVIDE (_GOT_END_ = .);
173
174  .jcr            : { KEEP (*(.jcr)) } > CODE
175
176  /* We want the small data sections together, so single-instruction offsets
177     can access them all, and initialized data all before uninitialized, so
178     we can shorten the on-disk segment size.  */
179  .sdata          : { *(.sdata) *(.gnu.linkonce.s.*)    } >CODE
180  _edata  =  .;
181  PROVIDE (edata = .);
182  .sbss      :
183  {
184    PROVIDE (__sbss_start = .);
185    *(.sbss)
186    *(.scommon)
187    *(.dynsbss)
188    PROVIDE (__sbss_end = .);
189  } > CODE
190  .plt   : { *(.plt) }  > CODE
191  .bss       :
192  {
193   PROVIDE (__bss_start = .);
194   *(.dynbss)
195   *(.bss)
196   *(COMMON)
197  . = ALIGN(16);
198  } > CODE
199  . = ALIGN(16);
200  _end = . ;
201  __rtems_end = . ;
202  PROVIDE (end = .);
203  /DISCARD/ :
204  {
205    *(.comment)
206  }
207
208
209  /* Stabs debugging sections.  */
210  .stab 0 : { *(.stab) }
211  .stabstr 0 : { *(.stabstr) }
212  .stab.excl 0 : { *(.stab.excl) }
213  .stab.exclstr 0 : { *(.stab.exclstr) }
214  .stab.index 0 : { *(.stab.index) }
215  .stab.indexstr 0 : { *(.stab.indexstr) }
216  .comment 0 : { *(.comment) }
217
218  /* DWARF debug sections.
219     Symbols in the DWARF debugging sections are relative to the beginning
220     of the section so we begin them at 0.  */
221  /* DWARF 1 */
222  .debug          0 : { *(.debug) }
223  .line           0 : { *(.line) }
224 
225  /* GNU DWARF 1 extensions */
226  .debug_srcinfo  0 : { *(.debug_srcinfo) }
227  .debug_sfnames  0 : { *(.debug_sfnames) }
228 
229  /* DWARF 1.1 and DWARF 2 */
230  .debug_aranges  0 : { *(.debug_aranges) }
231  .debug_pubnames 0 : { *(.debug_pubnames) }
232 
233  /* DWARF 2 */
234  .debug_info     0 : { *(.debug_info) }
235  .debug_abbrev   0 : { *(.debug_abbrev) }
236  .debug_line     0 : { *(.debug_line) }
237  .debug_frame    0 : { *(.debug_frame) }
238  .debug_str      0 : { *(.debug_str) }
239  .debug_loc      0 : { *(.debug_loc) }
240  .debug_macinfo  0 : { *(.debug_macinfo) }
241 
242  /* SGI/MIPS DWARF 2 extensions */
243  .debug_weaknames 0 : { *(.debug_weaknames) }
244  .debug_funcnames 0 : { *(.debug_funcnames) }
245  .debug_typenames 0 : { *(.debug_typenames) }
246  .debug_varnames  0 : { *(.debug_varnames) }
247  /* These must appear regardless of  .  */
248}
Note: See TracBrowser for help on using the repository browser.