* Makefile.am: Rebuild dependencies.
[binutils.git] / ld / scripttempl / elfd10v.sc
blob322eef49e29468a11de766393c5b440aacc83b6d
2 # Unusual variables checked by this code:
3 #       NOP - two byte opcode for no-op (defaults to 0)
4 #       DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
5 #       OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
6 #               (e.g., .PARISC.milli)
7 #       OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
8 #               (e.g., .PARISC.global)
9 #       OTHER_SECTIONS - at the end
10 #       EXECUTABLE_SYMBOLS - symbols that must be defined for an
11 #               executable (e.g., _DYNAMIC_LINK)
12 #       TEXT_START_SYMBOLS - symbols that appear at the start of the
13 #               .text section.
14 #       DATA_START_SYMBOLS - symbols that appear at the start of the
15 #               .data section.
16 #       OTHER_BSS_SYMBOLS - symbols that appear at the start of the
17 #               .bss section besides __bss_start.
18 #       DATA_PLT - .plt should be in data segment, not text segment.
19 #       EMBEDDED - whether this is for an embedded system. 
21 # When adding sections, do note that the names of some sections are used
22 # when specifying the start address of the next.
24 test -z "$ENTRY" && ENTRY=_start
25 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
26 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
27 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
28 test "$LD_FLAG" = "N" && DATA_ADDR=.
29 INTERP=".interp   ${RELOCATING-0} : { *(.interp)        }"
30 PLT=".plt    ${RELOCATING-0} : { *(.plt)        }"
33 CTOR=".ctors ${CONSTRUCTING-0} : 
34   {
35     ${CONSTRUCTING+${CTOR_START}}
36     /* gcc uses crtbegin.o to find the start of
37        the constructors, so we make sure it is
38        first.  Because this is a wildcard, it
39        doesn't matter if the user does not
40        actually link against crtbegin.o; the
41        linker won't look for a file to match a
42        wildcard.  The wildcard also means that it
43        doesn't matter which directory crtbegin.o
44        is in.  */
46     KEEP (*crtbegin.o(.ctors))
48     /* We don't want to include the .ctor section from
49        from the crtend.o file until after the sorted ctors.
50        The .ctor section from the crtend file contains the
51        end of ctors marker and it must be last */
53     KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
54     KEEP (*(SORT(.ctors.*)))
55     KEEP (*(.ctors))
56     ${CONSTRUCTING+${CTOR_END}}
57   }"
59 DTOR=" .dtors       ${CONSTRUCTING-0} :
60   {
61     ${CONSTRUCTING+${DTOR_START}}
62     KEEP (*crtbegin.o(.dtors))
63     KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
64     KEEP (*(SORT(.dtors.*)))
65     KEEP (*(.dtors))
66     ${CONSTRUCTING+${DTOR_END}}
67   }"
70 # if this is for an embedded system, don't add SIZEOF_HEADERS.
71 if [ -z "$EMBEDDED" ]; then
72    test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS"
73 else
74    test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}"
77 cat <<EOF
78 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
79               "${LITTLE_OUTPUT_FORMAT}")
80 OUTPUT_ARCH(${OUTPUT_ARCH})
81 ENTRY(${ENTRY})
83 ${RELOCATING+${LIB_SEARCH_DIRS}}
84 ${RELOCATING+/* Do we need any of these for elf?
85    __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
86 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
87 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
88   if gld -r is used and the intermediate file has sections starting
89   at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
90   bug.  But for now assigning the zero vmas works.  */}
91 SECTIONS
93   /* Read-only sections, merged into text segment: */
94   ${CREATE_SHLIB-${RELOCATING+. = ${READONLY_BASE_ADDRESS};}}
95   ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
96   ${CREATE_SHLIB-${INTERP}}
97   .hash        ${RELOCATING-0} : { *(.hash)             }
98   .dynsym      ${RELOCATING-0} : { *(.dynsym)           }
99   .dynstr      ${RELOCATING-0} : { *(.dynstr)           }
100   .rel.text    ${RELOCATING-0} : { *(.rel.text)         }
101   .rela.text   ${RELOCATING-0} : { *(.rela.text)        }
102   .rel.data    ${RELOCATING-0} : { *(.rel.data)         }
103   .rela.data   ${RELOCATING-0} : { *(.rela.data)        }
104   .rel.rodata  ${RELOCATING-0} : { *(.rel.rodata)       }
105   .rela.rodata ${RELOCATING-0} : { *(.rela.rodata)      }
106   .rel.got     ${RELOCATING-0} : { *(.rel.got)          }
107   .rela.got    ${RELOCATING-0} : { *(.rela.got)         }
108   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)        }
109   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)       }
110   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)        }
111   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)       }
112   .rel.init    ${RELOCATING-0} : { *(.rel.init) }
113   .rela.init   ${RELOCATING-0} : { *(.rela.init)        }
114   .rel.fini    ${RELOCATING-0} : { *(.rel.fini) }
115   .rela.fini   ${RELOCATING-0} : { *(.rela.fini)        }
116   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)          }
117   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)         }
118   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
119   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
120   ${DATA_PLT-${PLT}}
121   .rodata  ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
122   .rodata1 ${RELOCATING-0} : { *(.rodata1) }
123   ${RELOCATING+${OTHER_READONLY_SECTIONS}}
125   /* Adjust the address for the data segment.  */
126   ${RELOCATING+. = ${DATA_ADDR-ALIGN(4);}}
128   .data  ${RELOCATING-0} :
129   {
130     ${RELOCATING+${DATA_START_SYMBOLS}}
131     *(.data)
132     *(.data.*)
133     *(.gnu.linkonce.d*)
134     ${CONSTRUCTING+CONSTRUCTORS}
135   }
136   .data1 ${RELOCATING-0} : { *(.data1) }
137   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
138   ${RELOCATING+${CTOR}}
139   ${RELOCATING+${DTOR}}
140   .got         ${RELOCATING-0} : { *(.got.plt) *(.got) }
141   .dynamic     ${RELOCATING-0} : { *(.dynamic) }
142   ${DATA_PLT+${PLT}}
143   /* We want the small data sections together, so single-instruction offsets
144      can access them all, and initialized data all before uninitialized, so
145      we can shorten the on-disk segment size.  */
146   .sdata   ${RELOCATING-0} : { *(.sdata) }
147   ${RELOCATING+_edata  =  .;}
148   ${RELOCATING+PROVIDE (edata = .);}
149   ${RELOCATING+__bss_start = .;}
150   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
151   .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
152   .bss     ${RELOCATING-0} :
153   {
154    *(.dynbss)
155    *(.bss)
156    *(COMMON)
157   }
158   ${RELOCATING+_end = . ;}
159   ${RELOCATING+PROVIDE (end = .);}
161   /* Stabs debugging sections.  */
162   .stab 0 : { *(.stab) }
163   .stabstr 0 : { *(.stabstr) }
164   .stab.excl 0 : { *(.stab.excl) }
165   .stab.exclstr 0 : { *(.stab.exclstr) }
166   .stab.index 0 : { *(.stab.index) }
167   .stab.indexstr 0 : { *(.stab.indexstr) }
169   .comment 0 : { *(.comment) }
171   /* DWARF debug sections.
172      Symbols in the DWARF debugging sections are relative to the beginning
173      of the section so we begin them at 0.  */
175   /* DWARF 1 */
176   .debug          0 : { *(.debug) }
177   .line           0 : { *(.line) }
179   /* GNU DWARF 1 extensions */
180   .debug_srcinfo  0 : { *(.debug_srcinfo) }
181   .debug_sfnames  0 : { *(.debug_sfnames) }
183   /* DWARF 1.1 and DWARF 2 */
184   .debug_aranges  0 : { *(.debug_aranges) }
185   .debug_pubnames 0 : { *(.debug_pubnames) }
187   /* DWARF 2 */
188   .debug_info     0 : { *(.debug_info) }
189   .debug_abbrev   0 : { *(.debug_abbrev) }
190   .debug_line     0 : { *(.debug_line) }
191   .debug_frame    0 : { *(.debug_frame) }
192   .debug_str      0 : { *(.debug_str) }
193   .debug_loc      0 : { *(.debug_loc) }
194   .debug_macinfo  0 : { *(.debug_macinfo) }
196   /* SGI/MIPS DWARF 2 extensions */
197   .debug_weaknames 0 : { *(.debug_weaknames) }
198   .debug_funcnames 0 : { *(.debug_funcnames) }
199   .debug_typenames 0 : { *(.debug_typenames) }
200   .debug_varnames  0 : { *(.debug_varnames) }
202   ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
204   /* These must appear regardless of ${RELOCATING}.  */
205   ${OTHER_SECTIONS}
208   /* Hmmm, there's got to be a better way.  This sets the stack to the
209      top of the simulator memory (i.e. top of 64K data space). */
210   .stack 0x00007FFE : { _stack = .; *(.stack) }
212   .text    ${RELOCATING+${TEXT_START_ADDR}} :
213   {
214     ${RELOCATING+${TEXT_START_SYMBOLS}}
215     KEEP (*(.init))
216     KEEP (*(.fini))
217     *(.text)
218     *(.text.*)
219     /* .gnu.warning sections are handled specially by elf32.em.  */
220     *(.gnu.warning)
221     *(.gnu.linkonce.t*)
222   } =${NOP-0}
223   ${RELOCATING+_etext = .;}
224   ${RELOCATING+PROVIDE (etext = .);}