Upload Tizen:Base source
[external/binutils.git] / ld / scripttempl / avr.sc
1 cat <<EOF
2 OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
3 OUTPUT_ARCH(${ARCH})
4
5 MEMORY
6 {
7   text   (rx)   : ORIGIN = 0, LENGTH = $TEXT_LENGTH
8   data   (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
9   eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
10   fuse      (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
11   lock      (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
12   signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
13 }
14
15 SECTIONS
16 {
17   /* Read-only sections, merged into text segment: */
18   ${TEXT_DYNAMIC+${DYNAMIC}}
19   .hash        ${RELOCATING-0} : { *(.hash)             }
20   .dynsym      ${RELOCATING-0} : { *(.dynsym)           }
21   .dynstr      ${RELOCATING-0} : { *(.dynstr)           }
22   .gnu.version ${RELOCATING-0} : { *(.gnu.version)      }
23   .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)  }
24   .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)  }
25
26   .rel.init    ${RELOCATING-0} : { *(.rel.init)         }
27   .rela.init   ${RELOCATING-0} : { *(.rela.init)        }
28   .rel.text    ${RELOCATING-0} :
29     {
30       *(.rel.text)
31       ${RELOCATING+*(.rel.text.*)}
32       ${RELOCATING+*(.rel.gnu.linkonce.t*)}
33     }
34   .rela.text   ${RELOCATING-0} :
35     {
36       *(.rela.text)
37       ${RELOCATING+*(.rela.text.*)}
38       ${RELOCATING+*(.rela.gnu.linkonce.t*)}
39     }
40   .rel.fini    ${RELOCATING-0} : { *(.rel.fini)         }
41   .rela.fini   ${RELOCATING-0} : { *(.rela.fini)        }
42   .rel.rodata  ${RELOCATING-0} :
43     {
44       *(.rel.rodata)
45       ${RELOCATING+*(.rel.rodata.*)}
46       ${RELOCATING+*(.rel.gnu.linkonce.r*)}
47     }
48   .rela.rodata ${RELOCATING-0} :
49     {
50       *(.rela.rodata)
51       ${RELOCATING+*(.rela.rodata.*)}
52       ${RELOCATING+*(.rela.gnu.linkonce.r*)}
53     }
54   .rel.data    ${RELOCATING-0} :
55     {
56       *(.rel.data)
57       ${RELOCATING+*(.rel.data.*)}
58       ${RELOCATING+*(.rel.gnu.linkonce.d*)}
59     }
60   .rela.data   ${RELOCATING-0} :
61     {
62       *(.rela.data)
63       ${RELOCATING+*(.rela.data.*)}
64       ${RELOCATING+*(.rela.gnu.linkonce.d*)}
65     }
66   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)        }
67   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)       }
68   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)        }
69   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)       }
70   .rel.got     ${RELOCATING-0} : { *(.rel.got)          }
71   .rela.got    ${RELOCATING-0} : { *(.rela.got)         }
72   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)          }
73   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)         }
74   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
75   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
76
77   /* Internal text space or external memory.  */
78   .text ${RELOCATING-0} :
79   {
80     *(.vectors)
81     KEEP(*(.vectors))
82
83     /* For data that needs to reside in the lower 64k of progmem.  */
84     *(.progmem.gcc*)
85     *(.progmem*)
86     ${RELOCATING+. = ALIGN(2);}
87
88     ${CONSTRUCTING+ __trampolines_start = . ; }
89     /* The jump trampolines for the 16-bit limited relocs will reside here.  */
90     *(.trampolines)
91     *(.trampolines*)
92     ${CONSTRUCTING+ __trampolines_end = . ; }
93
94     /* For future tablejump instruction arrays for 3 byte pc devices.
95        We don't relax jump/call instructions within these sections.  */
96     *(.jumptables) 
97     *(.jumptables*) 
98
99     /* For code that needs to reside in the lower 128k progmem.  */
100     *(.lowtext)
101     *(.lowtext*)
102
103     ${CONSTRUCTING+ __ctors_start = . ; }
104     ${CONSTRUCTING+ *(.ctors) }
105     ${CONSTRUCTING+ __ctors_end = . ; }
106     ${CONSTRUCTING+ __dtors_start = . ; }
107     ${CONSTRUCTING+ *(.dtors) }
108     ${CONSTRUCTING+ __dtors_end = . ; }
109     KEEP(SORT(*)(.ctors))
110     KEEP(SORT(*)(.dtors))
111
112     /* From this point on, we don't bother about wether the insns are
113        below or above the 16 bits boundary.  */
114     *(.init0)  /* Start here after reset.  */
115     KEEP (*(.init0))
116     *(.init1)
117     KEEP (*(.init1))
118     *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
119     KEEP (*(.init2))
120     *(.init3)
121     KEEP (*(.init3))
122     *(.init4)  /* Initialize data and BSS.  */
123     KEEP (*(.init4))
124     *(.init5)
125     KEEP (*(.init5))
126     *(.init6)  /* C++ constructors.  */
127     KEEP (*(.init6))
128     *(.init7)
129     KEEP (*(.init7))
130     *(.init8)
131     KEEP (*(.init8))
132     *(.init9)  /* Call main().  */
133     KEEP (*(.init9))
134     *(.text)
135     ${RELOCATING+. = ALIGN(2);}
136     *(.text.*)
137     ${RELOCATING+. = ALIGN(2);}
138     *(.fini9)  /* _exit() starts here.  */
139     KEEP (*(.fini9))
140     *(.fini8)
141     KEEP (*(.fini8))
142     *(.fini7)
143     KEEP (*(.fini7))
144     *(.fini6)  /* C++ destructors.  */
145     KEEP (*(.fini6))
146     *(.fini5)
147     KEEP (*(.fini5))
148     *(.fini4)
149     KEEP (*(.fini4))
150     *(.fini3)
151     KEEP (*(.fini3))
152     *(.fini2)
153     KEEP (*(.fini2))
154     *(.fini1)
155     KEEP (*(.fini1))
156     *(.fini0)  /* Infinite loop after program termination.  */
157     KEEP (*(.fini0))
158     ${RELOCATING+ _etext = . ; }
159   } ${RELOCATING+ > text}
160
161   .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))}
162   {
163     ${RELOCATING+ PROVIDE (__data_start = .) ; }
164     *(.data)
165     *(.data*)
166     *(.rodata)  /* We need to include .rodata here if gcc is used */
167     *(.rodata*) /* with -fdata-sections.  */
168     *(.gnu.linkonce.d*)
169     ${RELOCATING+. = ALIGN(2);}
170     ${RELOCATING+ _edata = . ; }
171     ${RELOCATING+ PROVIDE (__data_end = .) ; }
172   } ${RELOCATING+ > data}
173
174   .bss ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
175   {
176     ${RELOCATING+ PROVIDE (__bss_start = .) ; }
177     *(.bss)
178     *(.bss*)
179     *(COMMON)
180     ${RELOCATING+ PROVIDE (__bss_end = .) ; }
181   } ${RELOCATING+ > data}
182
183   ${RELOCATING+ __data_load_start = LOADADDR(.data); }
184   ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
185
186   /* Global data not cleared after reset.  */
187   .noinit ${RELOCATING-0}:
188   {
189     ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
190     *(.noinit*)
191     ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
192     ${RELOCATING+ _end = . ;  }
193     ${RELOCATING+ PROVIDE (__heap_start = .) ; }
194   } ${RELOCATING+ > data}
195
196   .eeprom ${RELOCATING-0}:
197   {
198     *(.eeprom*)
199     ${RELOCATING+ __eeprom_end = . ; }
200   } ${RELOCATING+ > eeprom}
201
202   .fuse ${RELOCATING-0}:
203   {
204     KEEP(*(.fuse))
205     KEEP(*(.lfuse))
206     KEEP(*(.hfuse))
207     KEEP(*(.efuse))
208   } ${RELOCATING+ > fuse}
209
210   .lock ${RELOCATING-0}:
211   {
212     KEEP(*(.lock*))
213   } ${RELOCATING+ > lock}
214
215   .signature ${RELOCATING-0}:
216   {
217     KEEP(*(.signature*))
218   } ${RELOCATING+ > signature}
219
220   /* Stabs debugging sections.  */
221   .stab 0 : { *(.stab) }
222   .stabstr 0 : { *(.stabstr) }
223   .stab.excl 0 : { *(.stab.excl) }
224   .stab.exclstr 0 : { *(.stab.exclstr) }
225   .stab.index 0 : { *(.stab.index) }
226   .stab.indexstr 0 : { *(.stab.indexstr) }
227   .comment 0 : { *(.comment) }
228  
229   /* DWARF debug sections.
230      Symbols in the DWARF debugging sections are relative to the beginning
231      of the section so we begin them at 0.  */
232
233   /* DWARF 1 */
234   .debug          0 : { *(.debug) }
235   .line           0 : { *(.line) }
236
237   /* GNU DWARF 1 extensions */
238   .debug_srcinfo  0 : { *(.debug_srcinfo) }
239   .debug_sfnames  0 : { *(.debug_sfnames) }
240
241   /* DWARF 1.1 and DWARF 2 */
242   .debug_aranges  0 : { *(.debug_aranges) }
243   .debug_pubnames 0 : { *(.debug_pubnames) }
244
245   /* DWARF 2 */
246   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
247   .debug_abbrev   0 : { *(.debug_abbrev) }
248   .debug_line     0 : { *(.debug_line) }
249   .debug_frame    0 : { *(.debug_frame) }
250   .debug_str      0 : { *(.debug_str) }
251   .debug_loc      0 : { *(.debug_loc) }
252   .debug_macinfo  0 : { *(.debug_macinfo) }
253 }
254 EOF
255