* scripttempl/elf32cr16.sc: Emit empty script for ld -r and ld -Ur.
[external/binutils.git] / ld / scripttempl / elfi370.sc
1 #
2 # This is just a raw copy of elfppc.sc and has not been otherwise modified
3 #
4 # Unusual variables checked by this code:
5 #       NOP - four byte opcode for no-op (defaults to 0)
6 #       DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
7 #       OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
8 #               (e.g., .PARISC.milli)
9 #       OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
10 #               (e.g., .PARISC.global)
11 #       ATTRS_SECTIONS - at the end
12 #       OTHER_SECTIONS - at the end
13 #       EXECUTABLE_SYMBOLS - symbols that must be defined for an
14 #               executable (e.g., _DYNAMIC_LINK)
15 #       TEXT_START_SYMBOLS - symbols that appear at the start of the
16 #               .text section.
17 #       DATA_START_SYMBOLS - symbols that appear at the start of the
18 #               .data section.
19 #       OTHER_BSS_SYMBOLS - symbols that appear at the start of the
20 #               .bss section besides __bss_start.
21 #
22 # When adding sections, do note that the names of some sections are used
23 # when specifying the start address of the next.
24 #
25 test -z "$ENTRY" && ENTRY=_start
26 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
27 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
28 test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
29 test "$LD_FLAG" = "N" && DATA_ADDR=.
30 SBSS2=".sbss2  : { *(.sbss2) }"
31 SDATA2=".sdata2  : { *(.sdata2) }"
32 INTERP=".interp  : { *(.interp) }"
33 PLT=".plt  : { *(.plt) }"
34 cat <<EOF
35 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
36               "${LITTLE_OUTPUT_FORMAT}")
37 OUTPUT_ARCH(${ARCH})
38 ${RELOCATING+ENTRY(${ENTRY})}
39
40 ${RELOCATING+${LIB_SEARCH_DIRS}}
41 ${RELOCATING+/* Do we need any of these for elf?
42    __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
43 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
44
45 ${RELOCATING+PROVIDE (__stack = 0);}
46 SECTIONS
47 {
48   /* Read-only sections, merged into text segment: */
49   ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
50   ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
51   ${CREATE_SHLIB-${INTERP}}
52   .hash          : { *(.hash)           }
53   .dynsym        : { *(.dynsym)         }
54   .dynstr        : { *(.dynstr)         }
55   .gnu.version  : { *(.gnu.version)      }
56   .gnu.version_d  : { *(.gnu.version_d)  }
57   .gnu.version_r  : { *(.gnu.version_r)  }
58   .rela.text    :
59     { *(.rela.text) *(.rela.gnu.linkonce.t*) }
60   .rela.data    :
61     { *(.rela.data) *(.rela.gnu.linkonce.d*) }
62   .rela.rodata  :
63     { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
64   .rela.got      : { *(.rela.got)       }
65   .rela.got1     : { *(.rela.got1)      }
66   .rela.got2     : { *(.rela.got2)      }
67   .rela.ctors    : { *(.rela.ctors)     }
68   .rela.dtors    : { *(.rela.dtors)     }
69   .rela.init     : { *(.rela.init)      }
70   .rela.fini     : { *(.rela.fini)      }
71   .rela.bss      : { *(.rela.bss)       }
72   .rela.plt      : { *(.rela.plt)       }
73   .rela.sdata    : { *(.rela.sdata)     }
74   .rela.sbss     : { *(.rela.sbss)      }
75   .rela.sdata2   : { *(.rela.sdata2)    }
76   .rela.sbss2    : { *(.rela.sbss2)     }
77   .text     :
78   {
79     ${RELOCATING+${TEXT_START_SYMBOLS}}
80     *(.text)
81     /* .gnu.warning sections are handled specially by elf32.em.  */
82     *(.gnu.warning)
83     *(.gnu.linkonce.t*)
84   } =${NOP-0}
85   .init          : { *(.init)           } =${NOP-0}
86   .fini          : { *(.fini)           } =${NOP-0}
87   .rodata        : { *(.rodata) *(.gnu.linkonce.r*) }
88   .rodata1       : { *(.rodata1) }
89   ${RELOCATING+_etext = .;}
90   ${RELOCATING+PROVIDE (etext = .);}
91   ${CREATE_SHLIB-${SDATA2}}
92   ${CREATE_SHLIB-${SBSS2}}
93   ${OTHER_READONLY_SECTIONS}
94
95   /* Adjust the address for the data segment.  We want to adjust up to
96      the same address within the page on the next page up.  It would
97      be more correct to do this:
98        ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};}
99      The current expression does not correctly handle the case of a
100      text segment ending precisely at the end of a page; it causes the
101      data segment to skip a page.  The above expression does not have
102      this problem, but it will currently (2/95) cause BFD to allocate
103      a single segment, combining both text and data, for this case.
104      This will prevent the text segment from being shared among
105      multiple executions of the program; I think that is more
106      important than losing a page of the virtual address space (note
107      that no actual memory is lost; the page which is skipped can not
108      be referenced).  */
109   ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
110
111   .data   :
112   {
113     ${RELOCATING+${DATA_START_SYMBOLS}}
114     *(.data)
115     *(.gnu.linkonce.d*)
116     ${CONSTRUCTING+CONSTRUCTORS}
117   }
118   .data1  : { *(.data1) }
119   ${OTHER_READWRITE_SECTIONS}
120
121   .got1          : { *(.got1) }
122   .dynamic       : { *(.dynamic) }
123
124   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
125      get relocated with -mrelocatable. Also put in the .fixup pointers.
126      The current compiler no longer needs this, but keep it around for 2.7.2  */
127
128                 ${RELOCATING+PROVIDE (_GOT2_START_ = .);}
129   .got2          :  { *(.got2) }
130
131                 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
132   .ctors         : { *(.ctors) }
133                 ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
134
135                 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
136   .dtors         : { *(.dtors) }
137                 ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
138
139                 ${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
140   .fixup         : { *(.fixup) }
141                 ${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
142                 ${RELOCATING+PROVIDE (_GOT2_END_ = .);}
143
144                 ${RELOCATING+PROVIDE (_GOT_START_ = .);}
145   .got           : { *(.got) }
146   .got.plt       : { *(.got.plt) }
147   ${CREATE_SHLIB+${SDATA2}}
148   ${CREATE_SHLIB+${SBSS2}}
149                 ${RELOCATING+PROVIDE (_GOT_END_ = .);}
150
151   /* We want the small data sections together, so single-instruction offsets
152      can access them all, and initialized data all before uninitialized, so
153      we can shorten the on-disk segment size.  */
154   .sdata         : { *(.sdata) }
155   ${RELOCATING+_edata  =  .;}
156   ${RELOCATING+PROVIDE (edata = .);}
157   .sbss     :
158   {
159     ${RELOCATING+PROVIDE (__sbss_start = .);}
160     *(.sbss)
161     *(.scommon)
162     *(.dynsbss)
163     ${RELOCATING+PROVIDE (__sbss_end = .);}
164   }
165   ${PLT}
166   .bss      :
167   {
168    ${RELOCATING+${OTHER_BSS_SYMBOLS}}
169    ${RELOCATING+PROVIDE (__bss_start = .);}
170    *(.dynbss)
171    *(.bss)
172    *(COMMON)
173   }
174   ${RELOCATING+_end = . ;}
175   ${RELOCATING+PROVIDE (end = .);}
176
177   /* These are needed for ELF backends which have not yet been
178      converted to the new style linker.  */
179   .stab 0 : { *(.stab) }
180   .stabstr 0 : { *(.stabstr) }
181
182   /* DWARF debug sections.
183      Symbols in the DWARF debugging sections are relative to the beginning
184      of the section so we begin them at 0.  */
185
186   /* DWARF 1 */
187   .debug          0 : { *(.debug) }
188   .line           0 : { *(.line) }
189
190   /* GNU DWARF 1 extensions */
191   .debug_srcinfo  0 : { *(.debug_srcinfo) }
192   .debug_sfnames  0 : { *(.debug_sfnames) }
193
194   /* DWARF 1.1 and DWARF 2 */
195   .debug_aranges  0 : { *(.debug_aranges) }
196   .debug_pubnames 0 : { *(.debug_pubnames) }
197
198   /* DWARF 2 */
199   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
200   .debug_abbrev   0 : { *(.debug_abbrev) }
201   .debug_line     0 : { *(.debug_line) }
202   .debug_frame    0 : { *(.debug_frame) }
203   .debug_str      0 : { *(.debug_str) }
204   .debug_loc      0 : { *(.debug_loc) }
205   .debug_macinfo  0 : { *(.debug_macinfo) }
206
207   /* SGI/MIPS DWARF 2 extensions */
208   .debug_weaknames 0 : { *(.debug_weaknames) }
209   .debug_funcnames 0 : { *(.debug_funcnames) }
210   .debug_typenames 0 : { *(.debug_typenames) }
211   .debug_varnames  0 : { *(.debug_varnames) }
212
213   ${ATTRS_SECTIONS}
214   ${OTHER_SECTIONS}
215 }
216 EOF