Add support for msp430.
[external/binutils.git] / ld / scripttempl / elf32msp430_3.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 = $ROM_START,  LENGTH = $ROM_SIZE
8   data   (rwx)  : ORIGIN = $RAM_START,  LENGTH = $RAM_SIZE
9   vectors (rw)  : ORIGIN = 0xffe0,      LENGTH = 0x20
10 }
11
12 SECTIONS
13 {
14   /* Read-only sections, merged into text segment.  */
15   ${TEXT_DYNAMIC+${DYNAMIC}}
16   .hash        ${RELOCATING-0} : { *(.hash)             }
17   .dynsym      ${RELOCATING-0} : { *(.dynsym)           }
18   .dynstr      ${RELOCATING-0} : { *(.dynstr)           }
19   .gnu.version ${RELOCATING-0} : { *(.gnu.version)      }
20   .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)  }
21   .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)  }
22
23   .rel.init    ${RELOCATING-0} : { *(.rel.init) }
24   .rela.init   ${RELOCATING-0} : { *(.rela.init)        }
25   .rel.text    ${RELOCATING-0} :
26     {
27       *(.rel.text)
28       ${RELOCATING+*(.rel.text.*)}
29       ${RELOCATING+*(.rel.gnu.linkonce.t*)}
30     }
31   .rela.text   ${RELOCATING-0} :
32     {
33       *(.rela.text)
34       ${RELOCATING+*(.rela.text.*)}
35       ${RELOCATING+*(.rela.gnu.linkonce.t*)}
36     }
37   .rel.fini    ${RELOCATING-0} : { *(.rel.fini) }
38   .rela.fini   ${RELOCATING-0} : { *(.rela.fini)        }
39   .rel.rodata  ${RELOCATING-0} :
40     {
41       *(.rel.rodata)
42       ${RELOCATING+*(.rel.rodata.*)}
43       ${RELOCATING+*(.rel.gnu.linkonce.r*)}
44     }
45   .rela.rodata ${RELOCATING-0} :
46     {
47       *(.rela.rodata)
48       ${RELOCATING+*(.rela.rodata.*)}
49       ${RELOCATING+*(.rela.gnu.linkonce.r*)}
50     }
51   .rel.data    ${RELOCATING-0} :
52     {
53       *(.rel.data)
54       ${RELOCATING+*(.rel.data.*)}
55       ${RELOCATING+*(.rel.gnu.linkonce.d*)}
56     }
57   .rela.data   ${RELOCATING-0} :
58     {
59       *(.rela.data)
60       ${RELOCATING+*(.rela.data.*)}
61       ${RELOCATING+*(.rela.gnu.linkonce.d*)}
62     }
63   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)        }
64   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)       }
65   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)        }
66   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)       }
67   .rel.got     ${RELOCATING-0} : { *(.rel.got)          }
68   .rela.got    ${RELOCATING-0} : { *(.rela.got)         }
69   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)          }
70   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)         }
71   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
72   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
73
74   /* Internal text space.  */
75   .text :
76   {
77     *(.init)
78     ${RELOCATING+. = ALIGN(2);}
79     *(.text)
80     ${RELOCATING+. = ALIGN(2);}
81     *(.text.*)
82     ${RELOCATING+. = ALIGN(2);}
83     *(.fini)
84     ${RELOCATING+ _etext = . ; }
85   } ${RELOCATING+ > text}
86
87   .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))}
88   {  
89     ${RELOCATING+ PROVIDE (__data_start = .) ; }
90     *(.data)
91     *(.gnu.linkonce.d*)
92     ${RELOCATING+. = ALIGN(2);}
93     ${RELOCATING+ _edata = . ; }
94   } ${RELOCATING+ > data}
95   
96   .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
97   {
98     ${RELOCATING+ PROVIDE (__bss_start = .) ; }
99     *(.bss)
100     *(COMMON)
101     ${RELOCATING+ PROVIDE (__bss_end = .) ; }
102     ${RELOCATING+ _end = . ;  }
103   } ${RELOCATING+ > data}
104
105   .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} :
106   {
107     ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
108     *(.noinit)
109     *(COMMON)
110     ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
111     ${RELOCATING+ _end = . ;  }
112   } ${RELOCATING+ > data}
113
114   .vectors ${RELOCATING-0}:
115   {
116     ${RELOCATING+ PROVIDE (__vectors_start = .) ; }
117     *(.vectors*)
118     ${RELOCATING+ _vectors_end = . ; }
119   } ${RELOCATING+ > vectors}
120
121   /* Stabs debugging sections.  */
122   .stab 0 : { *(.stab) } 
123   .stabstr 0 : { *(.stabstr) }
124   .stab.excl 0 : { *(.stab.excl) }
125   .stab.exclstr 0 : { *(.stab.exclstr) }
126   .stab.index 0 : { *(.stab.index) }
127   .stab.indexstr 0 : { *(.stab.indexstr) }
128   .comment 0 : { *(.comment) }
129  
130   /* DWARF debug sections.
131      Symbols in the DWARF debugging sections are relative to the beginning
132      of the section so we begin them at 0.  */
133
134   /* DWARF 1 */
135   .debug          0 : { *(.debug) }
136   .line           0 : { *(.line) }
137
138   /* GNU DWARF 1 extensions */
139   .debug_srcinfo  0 : { *(.debug_srcinfo) }
140   .debug_sfnames  0 : { *(.debug_sfnames) }
141
142   /* DWARF 1.1 and DWARF 2 */
143   .debug_aranges  0 : { *(.debug_aranges) }
144   .debug_pubnames 0 : { *(.debug_pubnames) }
145
146   /* DWARF 2 */
147   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
148   .debug_abbrev   0 : { *(.debug_abbrev) }
149   .debug_line     0 : { *(.debug_line) }
150   .debug_frame    0 : { *(.debug_frame) }
151   .debug_str      0 : { *(.debug_str) }
152   .debug_loc      0 : { *(.debug_loc) }
153   .debug_macinfo  0 : { *(.debug_macinfo) }
154
155   PROVIDE (__stack = ${STACK}) ;
156 }
157 EOF