source: rtems/c/src/lib/libbsp/i386/pc386/startup/linkcmds @ ba64905

4.115
Last change on this file since ba64905 was 9559674, checked in by Joel Sherrill <joel.sherrill@…>, on 12/09/09 at 22:37:12

2009-12-09 Joel Sherrill <joel.sherrill@…>

  • startup/bspgetworkarea.c: Add debug printk's.
  • startup/linkcmds: Using "-Wl,--defsym -Wl,RamSize?=0x1000000" results in _RamSize being defined. Handle this properly.
  • Property mode set to 100644
File size: 8.2 KB
Line 
1/*
2 *  Copy of default "default linker script, for normal executables"
3 *  provided with binutils 2.18 with minor modifications for use
4 *  as pc386 linkcmds.  These changes include:
5 *
6 *    + sections commented out marked with "XXX commented out --joel"
7 *    + addition of m_hdr section
8 *    + addition of FreeBSD sysctl sections
9 *
10 *  $Id$
11 */
12
13/*
14 * XXX commented out --joel
15OUTPUT_FORMAT("elf32-i386", "elf32-i386",
16              "elf32-i386")
17OUTPUT_ARCH(i386)
18ENTRY(_start)
19*/
20HeapSize = DEFINED(HeapSize) ? HeapSize :
21          DEFINED(_HeapSize) ? _HeapSize : 0x0;
22RamSize = DEFINED(RamSize) ? RamSize    :
23          DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF;
24
25SECTIONS
26{
27  /* Read-only sections, merged into text segment: */
28/*
29 * XXX commented out --joel
30  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
31*/
32  .interp         : { *(.interp) }
33  .note.gnu.build-id : { *(.note.gnu.build-id) }
34  .hash           : { *(.hash) }
35  .gnu.hash       : { *(.gnu.hash) }
36  .dynsym         : { *(.dynsym) }
37  .dynstr         : { *(.dynstr) }
38  .gnu.version    : { *(.gnu.version) }
39  .gnu.version_d  : { *(.gnu.version_d) }
40  .gnu.version_r  : { *(.gnu.version_r) }
41  .rel.init       : { *(.rel.init) }
42  .rela.init      : { *(.rela.init) }
43  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
44  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
45  .rel.fini       : { *(.rel.fini) }
46  .rela.fini      : { *(.rela.fini) }
47  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
48  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
49  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
50  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
51  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
52  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
53  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
54  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
55  .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
56  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
57  .rel.ctors      : { *(.rel.ctors) }
58  .rela.ctors     : { *(.rela.ctors) }
59  .rel.dtors      : { *(.rel.dtors) }
60  .rela.dtors     : { *(.rela.dtors) }
61  .rel.got        : { *(.rel.got) }
62  .rela.got       : { *(.rela.got) }
63  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
64  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
65  .rel.plt        : { *(.rel.plt) }
66  .rela.plt       : { *(.rela.plt) }
67  .plt            : { *(.plt) }
68  .text           :
69  {
70   *(.m_hdr)
71    *(.text .stub .text.* .gnu.linkonce.t.*)
72    KEEP (*(.text.*personality*))
73    /* .gnu.warning sections are handled specially by elf32.em.  */
74    *(.gnu.warning)
75    /*
76     * Special FreeBSD sysctl sections.
77     */
78    . = ALIGN (16);
79    __start_set_sysctl_set = .;
80    *(set_sysctl_*);
81    __stop_set_sysctl_set = ABSOLUTE(.);
82    *(set_domain_*);
83    *(set_pseudo_*);
84
85  } =0x90909090
86
87  .init           :
88  {
89    KEEP (*(.init))
90  } =0x90909090
91  .fini           :
92  {
93    KEEP (*(.fini))
94  } =0x90909090
95  PROVIDE (__etext = .);
96  PROVIDE (_etext = .);
97  PROVIDE (etext = .);
98  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
99  .rodata1        : { *(.rodata1) }
100  .eh_frame_hdr : { *(.eh_frame_hdr) }
101  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
102  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
103  /* Adjust the address for the data segment.  We want to adjust up to
104     the same address within the page on the next page up.  */
105  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
106  /* Exception handling  */
107  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
108  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
109  /* Thread Local Storage sections  */
110  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
111  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
112  .preinit_array     :
113  {
114    PROVIDE_HIDDEN (__preinit_array_start = .);
115    KEEP (*(.preinit_array))
116    PROVIDE_HIDDEN (__preinit_array_end = .);
117  }
118  .init_array     :
119  {
120     PROVIDE_HIDDEN (__init_array_start = .);
121     KEEP (*(SORT(.init_array.*)))
122     KEEP (*(.init_array))
123     PROVIDE_HIDDEN (__init_array_end = .);
124  }
125  .fini_array     :
126  {
127    PROVIDE_HIDDEN (__fini_array_start = .);
128    KEEP (*(.fini_array))
129    KEEP (*(SORT(.fini_array.*)))
130    PROVIDE_HIDDEN (__fini_array_end = .);
131  }
132  .ctors          :
133  {
134    /* gcc uses crtbegin.o to find the start of
135       the constructors, so we make sure it is
136       first.  Because this is a wildcard, it
137       doesn't matter if the user does not
138       actually link against crtbegin.o; the
139       linker won't look for a file to match a
140       wildcard.  The wildcard also means that it
141       doesn't matter which directory crtbegin.o
142       is in.  */
143    KEEP (*crtbegin.o(.ctors))
144    KEEP (*crtbegin?.o(.ctors))
145    /* We don't want to include the .ctor section from
146       the crtend.o file until after the sorted ctors.
147       The .ctor section from the crtend file contains the
148       end of ctors marker and it must be last */
149    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
150    KEEP (*(SORT(.ctors.*)))
151    KEEP (*(.ctors))
152  }
153  .dtors          :
154  {
155    KEEP (*crtbegin.o(.dtors))
156    KEEP (*crtbegin?.o(.dtors))
157    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
158    KEEP (*(SORT(.dtors.*)))
159    KEEP (*(.dtors))
160  }
161  .jcr            : { KEEP (*(.jcr)) }
162  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
163  .dynamic        : { *(.dynamic) }
164  .got            : { *(.got) }
165  . = DATA_SEGMENT_RELRO_END (12, .);
166  .got.plt        : { *(.got.plt) }
167  .data           :
168  {
169    *(.data .data.* .gnu.linkonce.d.*)
170    KEEP (*(.gnu.linkonce.d.*personality*))
171    SORT(CONSTRUCTORS)
172  }
173  .data1          : { *(.data1) }
174  _edata = .; PROVIDE (edata = .);
175  __bss_start = .;
176  .bss            :
177  {
178   *(.dynbss)
179   *(.bss .bss.* .gnu.linkonce.b.*)
180   *(COMMON)
181   /* Align here to ensure that the .bss section occupies space up to
182      _end.  Align after .bss to ensure correct alignment even if the
183      .bss section disappears because there are no input sections.
184      FIXME: Why do we need it? When there is no .bss section, we don't
185      pad the .data section.  */
186   . = ALIGN(. != 0 ? 32 / 8 : 1);
187  }
188  . = ALIGN(32 / 8);
189  . = ALIGN(32 / 8);
190  _end = .; PROVIDE (end = .);
191  . = ALIGN(0x10);
192  WorkAreaBase = .;
193  . = DATA_SEGMENT_END (.);
194
195  /* Stabs debugging sections.  */
196  .stab          0 : { *(.stab) }
197  .stabstr       0 : { *(.stabstr) }
198  .stab.excl     0 : { *(.stab.excl) }
199  .stab.exclstr  0 : { *(.stab.exclstr) }
200  .stab.index    0 : { *(.stab.index) }
201  .stab.indexstr 0 : { *(.stab.indexstr) }
202  .comment       0 : { *(.comment) }
203  /* DWARF debug sections.
204     Symbols in the DWARF debugging sections are relative to the beginning
205     of the section so we begin them at 0.  */
206  /* DWARF 1 */
207  .debug          0 : { *(.debug) }
208  .line           0 : { *(.line) }
209  /* GNU DWARF 1 extensions */
210  .debug_srcinfo  0 : { *(.debug_srcinfo) }
211  .debug_sfnames  0 : { *(.debug_sfnames) }
212  /* DWARF 1.1 and DWARF 2 */
213  .debug_aranges  0 : { *(.debug_aranges) }
214  .debug_pubnames 0 : { *(.debug_pubnames) }
215  /* DWARF 2 */
216  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
217  .debug_abbrev   0 : { *(.debug_abbrev) }
218  .debug_line     0 : { *(.debug_line) }
219  .debug_frame    0 : { *(.debug_frame) }
220  .debug_str      0 : { *(.debug_str) }
221  .debug_loc      0 : { *(.debug_loc) }
222  .debug_macinfo  0 : { *(.debug_macinfo) }
223  /* SGI/MIPS DWARF 2 extensions */
224  .debug_weaknames 0 : { *(.debug_weaknames) }
225  .debug_funcnames 0 : { *(.debug_funcnames) }
226  .debug_typenames 0 : { *(.debug_typenames) }
227  .debug_varnames  0 : { *(.debug_varnames) }
228  /* DWARF 3 */
229  .debug_pubtypes 0 : { *(.debug_pubtypes) }
230  .debug_ranges   0 : { *(.debug_ranges) }
231  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
232  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
233}
Note: See TracBrowser for help on using the repository browser.