OSDN Git Service

Enable to track git://github.com/monaka/binutils.git
[pf3gnuchains/pf3gnuchains3x.git] / libgloss / moxie / moxie-elf-common.ld
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
18 OUTPUT_FORMAT("elf32-moxie")
19 OUTPUT_ARCH(moxie)
20 ENTRY(_start)
21 SECTIONS
22 {
23   /* Read-only sections, merged into text segment: */
24   . = 0x00001000;
25   .interp     : { *(.interp)    }
26   .hash          : { *(.hash)           }
27   .dynsym        : { *(.dynsym)         }
28   .dynstr        : { *(.dynstr)         }
29   .gnu.version   : { *(.gnu.version)    }
30   .gnu.version_d   : { *(.gnu.version_d)        }
31   .gnu.version_r   : { *(.gnu.version_r)        }
32   .rel.init      : { *(.rel.init)       }
33   .rela.init     : { *(.rela.init)      }
34   .rel.text      :
35     {
36       *(.rel.text)
37       *(.rel.text.*)
38       *(.rel.gnu.linkonce.t*)
39     }
40   .rela.text     :
41     {
42       *(.rela.text)
43       *(.rela.text.*)
44       *(.rela.gnu.linkonce.t*)
45     }
46   .rel.fini      : { *(.rel.fini)       }
47   .rela.fini     : { *(.rela.fini)      }
48   .rel.rodata    :
49     {
50       *(.rel.rodata)
51       *(.rel.rodata.*)
52       *(.rel.gnu.linkonce.r*)
53     }
54   .rela.rodata   :
55     {
56       *(.rela.rodata)
57       *(.rela.rodata.*)
58       *(.rela.gnu.linkonce.r*)
59     }
60   .rel.data      :
61     {
62       *(.rel.data)
63       *(.rel.data.*)
64       *(.rel.gnu.linkonce.d*)
65     }
66   .rela.data     :
67     {
68       *(.rela.data)
69       *(.rela.data.*)
70       *(.rela.gnu.linkonce.d*)
71     }
72   .rel.ctors     : { *(.rel.ctors)      }
73   .rela.ctors    : { *(.rela.ctors)     }
74   .rel.dtors     : { *(.rel.dtors)      }
75   .rela.dtors    : { *(.rela.dtors)     }
76   .rel.got       : { *(.rel.got)                }
77   .rela.got      : { *(.rela.got)               }
78   .rel.sdata     :
79     {
80       *(.rel.sdata)
81       *(.rel.sdata.*)
82       *(.rel.gnu.linkonce.s*)
83     }
84   .rela.sdata     :
85     {
86       *(.rela.sdata)
87       *(.rela.sdata.*)
88       *(.rela.gnu.linkonce.s*)
89     }
90   .rel.sbss      : { *(.rel.sbss)               }
91   .rela.sbss     : { *(.rela.sbss)      }
92   .rel.bss       : { *(.rel.bss)                }
93   .rela.bss      : { *(.rela.bss)               }
94   .rel.plt       : { *(.rel.plt)                }
95   .rela.plt      : { *(.rela.plt)               }
96   .plt      : { *(.plt) }
97   .text      :
98   {
99     *(.text)
100     *(.text.*)
101     *(.stub)
102     /* .gnu.warning sections are handled specially by elf32.em.  */
103     *(.gnu.warning)
104     *(.gnu.linkonce.t*)
105     *(.glue_7t) *(.glue_7)
106   } =0
107   .init          : 
108   { 
109     KEEP (*(.init))
110   } =0
111   _etext = .;
112   PROVIDE (etext = .);
113   .fini      :
114   {
115     KEEP (*(.fini))
116   } =0
117   .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
118   .rodata1   : { *(.rodata1) }
119   .eh_frame_hdr : { *(.eh_frame_hdr) }
120   /* Adjust the address for the data segment.  We want to adjust up to
121      the same address within the page on the next page up.  */
122   . = ALIGN(256) + (. & (256 - 1));
123   .data    :
124   {
125     *(.data)
126     *(.data.*)
127     *(.gnu.linkonce.d*)
128     SORT(CONSTRUCTORS)
129   }
130   .data1   : { *(.data1) }
131   .eh_frame : { KEEP (*(.eh_frame)) }
132   .gcc_except_table : { *(.gcc_except_table) }
133   .ctors   : 
134   {
135     /* gcc uses crtbegin.o to find the start of
136        the constructors, so we make sure it is
137        first.  Because this is a wildcard, it
138        doesn't matter if the user does not
139        actually link against crtbegin.o; the
140        linker won't look for a file to match a
141        wildcard.  The wildcard also means that it
142        doesn't matter which directory crtbegin.o
143        is in.  */
144     KEEP (*crtbegin.o(.ctors))
145     /* We don't want to include the .ctor section from
146        from 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 ) .ctors))
150     KEEP (*(SORT(.ctors.*)))
151     KEEP (*(.ctors))
152   }
153    .dtors         :
154   {
155     KEEP (*crtbegin.o(.dtors))
156     KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
157     KEEP (*(SORT(.dtors.*)))
158     KEEP (*(.dtors))
159   }
160   .jcr            : { KEEP (*(.jcr)) }
161   .got           : { *(.got.plt) *(.got) }
162   .dynamic       : { *(.dynamic) }
163   /* We want the small data sections together, so single-instruction offsets
164      can access them all, and initialized data all before uninitialized, so
165      we can shorten the on-disk segment size.  */
166   .sdata     : 
167   {
168     *(.sdata) 
169     *(.sdata.*)
170     *(.gnu.linkonce.s.*)
171   }
172   _edata = .;
173   PROVIDE (edata = .);
174   __bss_start = .;
175   __bss_start__ = .;
176   .sbss      :
177   {
178     *(.dynsbss)
179     *(.sbss)
180     *(.sbss.*)
181     *(.scommon)
182   }
183   .bss       :
184   {
185    *(.dynbss)
186    *(.bss)
187    *(.bss.*)
188    *(COMMON)
189    /* Align here to ensure that the .bss section occupies space up to
190       _end.  Align after .bss to ensure correct alignment even if the
191       .bss section disappears because there are no input sections.  */
192    . = ALIGN(32 / 8);
193   }
194   . = ALIGN(32 / 8);
195   _end = .;
196   _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
197   PROVIDE (end = .);
198   /* Stabs debugging sections.  */
199   .stab 0 : { *(.stab) }
200   .stabstr 0 : { *(.stabstr) }
201   .stab.excl 0 : { *(.stab.excl) }
202   .stab.exclstr 0 : { *(.stab.exclstr) }
203   .stab.index 0 : { *(.stab.index) }
204   .stab.indexstr 0 : { *(.stab.indexstr) }
205   .comment 0 : { *(.comment) }
206   /* DWARF debug sections.
207      Symbols in the DWARF debugging sections are relative to the beginning
208      of the section so we begin them at 0.  */
209   /* DWARF 1 */
210   .debug          0 : { *(.debug) }
211   .line           0 : { *(.line) }
212   /* GNU DWARF 1 extensions */
213   .debug_srcinfo  0 : { *(.debug_srcinfo) }
214   .debug_sfnames  0 : { *(.debug_sfnames) }
215   /* DWARF 1.1 and DWARF 2 */
216   .debug_aranges  0 : { *(.debug_aranges) }
217   .debug_pubnames 0 : { *(.debug_pubnames) }
218   /* DWARF 2 */
219   .debug_info     0 : { *(.debug_info) }
220   .debug_abbrev   0 : { *(.debug_abbrev) }
221   .debug_line     0 : { *(.debug_line) }
222   .debug_frame    0 : { *(.debug_frame) }
223   .debug_str      0 : { *(.debug_str) }
224   .debug_loc      0 : { *(.debug_loc) }
225   .debug_macinfo  0 : { *(.debug_macinfo) }
226   .debug_ranges   0 : { *(.debug_ranges) }
227   /* SGI/MIPS DWARF 2 extensions */
228   .debug_weaknames 0 : { *(.debug_weaknames) }
229   .debug_funcnames 0 : { *(.debug_funcnames) }
230   .debug_typenames 0 : { *(.debug_typenames) }
231   .debug_varnames  0 : { *(.debug_varnames) }
232   .stack 0x400000 : { _stack = .; *(.stack) }
233   /* These must appear regardless of  .  */
234 }