]>
Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | #!/bin/sh |
2 | # genscripts.sh - generate the ld-emulation-target specific files | |
4b95cf5c | 3 | # Copyright (C) 2004-2014 Free Software Foundation, Inc. |
f96b4a7b NC |
4 | # |
5 | # This file is part of the Gnu Linker. | |
6 | # | |
7 | # This program is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 3, or (at your option) | |
10 | # any later version. | |
11 | # | |
12 | # This program is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with GLD; see the file COPYING. If not, write to the Free | |
19 | # Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA | |
20 | # 02110-1301, USA. | |
252b5132 | 21 | # |
8fbdf3ab AM |
22 | # Usage: genscripts_extra.sh \ |
23 | # srcdir \ | |
24 | # libdir \ | |
dfcffada | 25 | # prefix \ |
8fbdf3ab AM |
26 | # exec_prefix \ |
27 | # host \ | |
28 | # target \ | |
29 | # target_alias \ | |
30 | # default_emulation \ | |
31 | # native_lib_dirs \ | |
32 | # use_sysroot \ | |
02ecc8e9 | 33 | # enable_initfini_array \ |
8fbdf3ab AM |
34 | # this_emulation \ |
35 | # optional: | |
36 | # tool_dir \ | |
37 | # customizer_script | |
252b5132 RH |
38 | # |
39 | # Sample usage: | |
8fbdf3ab AM |
40 | # |
41 | # genscripts_extra.sh \ | |
42 | # /sources/ld \ | |
43 | # /usr/local/lib \ | |
44 | # /usr/local \ | |
dfcffada | 45 | # /usr/local \ |
8fbdf3ab AM |
46 | # sparc-sun-sunos4.1.3 \ |
47 | # sparc-sun-sunos4.1.3 \ | |
48 | # sparc-sun-sunos4.1.3 \ | |
49 | # sun4 \ | |
50 | # "" \ | |
51 | # no \ | |
52 | # sun3 \ | |
53 | # sparc-sun-sunos4.1.3 \ | |
54 | # sparc.sh | |
55 | # | |
56 | # produces the linker scripts: | |
57 | # | |
58 | # sun3.x [default linker script] | |
59 | # sun3.xbn [used when the linker is invoked with "-N"] | |
60 | # sun3.xn [used when the linker is invoked with "-n"] | |
61 | # sun3.xr [used when the linker is invoked with "-r"] | |
62 | # sun3.xu [used when the linker is invoked with "-Ur"] | |
63 | # and maybe: | |
64 | # sun3.xc [used when the linker is invoked with "-z combreloc"] | |
65 | # sun3.xsc [used when the linker is invoked with "--shared"] | |
66 | # sun3.xdc [used when the linker is invoked with "-pie"] | |
e2a83dd0 | 67 | # sun3.xa [used when the linker is invoked with "--enable-auto-import"] |
8fbdf3ab AM |
68 | # |
69 | # It also produced the C source file: | |
70 | # | |
71 | # em_sun3.c | |
72 | # | |
73 | # which is then compiled into the linker. | |
74 | # | |
75 | # The linker scripts are created by running the shell script | |
76 | # /sources/ld/emulparams/sparc.sh to set the value of ${SCRIPT_NAME} | |
77 | # (and any other variables it wants to). ${SCRIPT_NAME} is then | |
78 | # invoked with a variable called ${LD_FLAG} to tell it which version | |
79 | # of the linker script to create. | |
80 | ||
252b5132 RH |
81 | |
82 | srcdir=$1 | |
83 | libdir=$2 | |
dfcffada AM |
84 | prefix=$3 |
85 | exec_prefix=$4 | |
86 | host=$5 | |
87 | target=$6 | |
88 | target_alias=$7 | |
89 | EMULATION_LIBPATH=$8 | |
90 | NATIVE_LIB_DIRS=$9 | |
d9fc3714 | 91 | shift 9 |
dfcffada | 92 | use_sysroot=$1 |
02ecc8e9 L |
93 | ENABLE_INITFINI_ARRAY=$2 |
94 | EMULATION_NAME=$3 | |
95 | TOOL_LIB=$4 | |
96 | CUSTOMIZER_SCRIPT=$5 | |
8fbdf3ab | 97 | |
8fbdf3ab AM |
98 | if [ "x${CUSTOMIZER_SCRIPT}" = "x" ] ; then |
99 | CUSTOMIZER_SCRIPT=${EMULATION_NAME} | |
d9fc3714 | 100 | fi |
8fbdf3ab | 101 | CUSTOMIZER_SCRIPT="${srcdir}/emulparams/${CUSTOMIZER_SCRIPT}.sh" |
252b5132 RH |
102 | |
103 | # Include the emulation-specific parameters: | |
f50230ae | 104 | . ${CUSTOMIZER_SCRIPT} |
252b5132 RH |
105 | |
106 | if test -d ldscripts; then | |
107 | true | |
108 | else | |
109 | mkdir ldscripts | |
110 | fi | |
111 | ||
9c8ebd6a DJ |
112 | # Set some flags for the emultempl scripts. USE_LIBPATH will |
113 | # be set for any libpath-using emulation; NATIVE will be set for a | |
114 | # libpath-using emulation where ${host} = ${target}. NATIVE | |
115 | # may already have been set by the emulparams file, but that's OK | |
116 | # (it'll just get set to "yes" twice). | |
117 | ||
118 | case " $EMULATION_LIBPATH " in | |
119 | *" ${EMULATION_NAME} "*) | |
120 | if [ "x${host}" = "x${target}" ] ; then | |
121 | NATIVE=yes | |
122 | USE_LIBPATH=yes | |
123 | elif [ "x${use_sysroot}" = "xyes" ] ; then | |
124 | USE_LIBPATH=yes | |
125 | fi | |
126 | ;; | |
127 | esac | |
128 | ||
129 | # If the emulparams file sets NATIVE, make sure USE_LIBPATH is set also. | |
130 | if test "x$NATIVE" = "xyes" ; then | |
131 | USE_LIBPATH=yes | |
132 | fi | |
133 | ||
252b5132 RH |
134 | # Set the library search path, for libraries named by -lfoo. |
135 | # If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used. | |
136 | # Otherwise, the default is set here. | |
137 | # | |
138 | # The format is the usual list of colon-separated directories. | |
139 | # To force a logically empty LIB_PATH, do LIBPATH=":". | |
9c8ebd6a DJ |
140 | # |
141 | # If we are using a sysroot, prefix library paths with "=" to indicate this. | |
142 | # | |
143 | # If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of | |
144 | # the library path with the suffix applied. | |
252b5132 | 145 | |
0f70b6b5 AM |
146 | # Paths with LIBPATH_SUFFIX |
147 | lib_path1= | |
148 | # Paths without LIBPATH_SUFFIX | |
149 | lib_path2= | |
150 | if [ "${LIB_PATH}" != ":" ] ; then | |
151 | lib_path2=${LIB_PATH} | |
152 | fi | |
1dd3bf68 | 153 | |
0f70b6b5 AM |
154 | # Add args to lib_path1 and lib_path2, discarding any duplicates |
155 | append_to_lib_path() | |
156 | { | |
157 | if [ $# != 0 ]; then | |
158 | for lib in "$@"; do | |
159 | # The "=" is harmless if we aren't using a sysroot, but also needless. | |
160 | if [ "x${use_sysroot}" = "xyes" ] ; then | |
161 | lib="=${lib}" | |
162 | fi | |
f6f6c679 | 163 | skip_lib=no |
0f70b6b5 AM |
164 | if test -n "${LIBPATH_SUFFIX}"; then |
165 | case "${lib}" in | |
166 | *${LIBPATH_SUFFIX}) | |
167 | case :${lib_path1}: in | |
168 | *:${lib}:*) ;; | |
169 | ::) lib_path1=${lib} ;; | |
170 | *) lib_path1=${lib_path1}:${lib} ;; | |
171 | esac ;; | |
172 | *) | |
f6f6c679 L |
173 | if test -n "${LIBPATH_SUFFIX_SKIP}"; then |
174 | case "${lib}" in | |
175 | *${LIBPATH_SUFFIX_SKIP}) skip_lib=yes ;; | |
176 | esac | |
177 | fi | |
178 | if test "${skip_lib}" = "no"; then | |
179 | case :${lib_path1}: in | |
180 | *:${lib}${LIBPATH_SUFFIX}:*) ;; | |
181 | ::) lib_path1=${lib}${LIBPATH_SUFFIX} ;; | |
182 | *) lib_path1=${lib_path1}:${lib}${LIBPATH_SUFFIX} ;; | |
183 | esac | |
184 | fi ;; | |
185 | esac | |
186 | fi | |
187 | if test "${skip_lib}" = "no"; then | |
188 | case :${lib_path1}:${lib_path2}: in | |
189 | *:${lib}:*) ;; | |
190 | *::) lib_path2=${lib} ;; | |
191 | *) lib_path2=${lib_path2}:${lib} ;; | |
0f70b6b5 AM |
192 | esac |
193 | fi | |
0f70b6b5 AM |
194 | done |
195 | fi | |
196 | } | |
197 | ||
198 | # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native | |
199 | # except when LIBPATH=":". | |
200 | if [ "${LIB_PATH}" != ":" ] ; then | |
201 | libs= | |
202 | if [ "x${TOOL_LIB}" = "x" ] ; then | |
203 | if [ "x${NATIVE}" = "xyes" ] ; then | |
204 | libs="${exec_prefix}/${target_alias}/lib" | |
d460ab58 | 205 | fi |
0f70b6b5 AM |
206 | else |
207 | # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX} | |
208 | # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path, | |
209 | # because 64bit libraries may be in both places, depending on | |
210 | # cross-development setup method (e.g.: /usr/s390x-linux/lib64 | |
211 | # vs. /usr/s390-linux/lib64) | |
212 | case "${NATIVE}:${LIBPATH_SUFFIX}:${TOOL_LIB}" in | |
213 | :* | *::* | *:*:*${LIBPATH_SUFFIX}) ;; | |
214 | *) libs="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}" ;; | |
215 | esac | |
216 | libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}" | |
217 | fi | |
218 | append_to_lib_path ${libs} | |
252b5132 RH |
219 | fi |
220 | ||
0f70b6b5 AM |
221 | if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then |
222 | libs=${NATIVE_LIB_DIRS} | |
223 | if [ "x${NATIVE}" = "xyes" ] ; then | |
224 | case " ${libs} " in | |
225 | *" ${libdir} "*) ;; | |
226 | *) libs="${libdir} ${libs}" ;; | |
33423b7f MF |
227 | esac |
228 | fi | |
0f70b6b5 | 229 | append_to_lib_path ${libs} |
9c8ebd6a | 230 | fi |
252b5132 | 231 | |
0f70b6b5 AM |
232 | case :${lib_path1}:${lib_path2}: in |
233 | *:: | ::*) LIB_PATH=${lib_path1}${lib_path2} ;; | |
234 | *) LIB_PATH=${lib_path1}:${lib_path2} ;; | |
235 | esac | |
236 | ||
eb3d6bb8 | 237 | LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'` |
252b5132 | 238 | |
cdaeef2e | 239 | # We need it for testsuite. |
dc4f76f8 L |
240 | set $EMULATION_LIBPATH |
241 | if [ "x$1" = "x$EMULATION_NAME" ]; then | |
cdaeef2e | 242 | test -d tmpdir || mkdir tmpdir |
dc4f76f8 | 243 | rm -f tmpdir/libpath.exp |
cdaeef2e | 244 | echo "set libpath \"${LIB_PATH}\"" | sed -e 's/:/ /g' > tmpdir/libpath.exp |
dc4f76f8 | 245 | fi |
cdaeef2e | 246 | |
252b5132 RH |
247 | # Generate 5 or 6 script files from a master script template in |
248 | # ${srcdir}/scripttempl/${SCRIPT_NAME}.sh. Which one of the 5 or 6 | |
249 | # script files is actually used depends on command line options given | |
250 | # to ld. (SCRIPT_NAME was set in the emulparams_file.) | |
251 | # | |
252 | # A .x script file is the default script. | |
253 | # A .xr script is for linking without relocation (-r flag). | |
254 | # A .xu script is like .xr, but *do* create constructors (-Ur flag). | |
255 | # A .xn script is for linking with -n flag (mix text and data on same page). | |
256 | # A .xbn script is for linking with -N flag (mix text and data on same page). | |
257 | # A .xs script is for generating a shared library with the --shared | |
258 | # flag; it is only generated if $GENERATE_SHLIB_SCRIPT is set by the | |
259 | # emulation parameters. | |
db6751f2 JJ |
260 | # A .xc script is for linking with -z combreloc; it is only generated if |
261 | # $GENERATE_COMBRELOC_SCRIPT is set by the emulation parameters or | |
262 | # $SCRIPT_NAME is "elf". | |
263 | # A .xsc script is for linking with --shared -z combreloc; it is generated | |
264 | # if $GENERATE_COMBRELOC_SCRIPT is set by the emulation parameters or | |
265 | # $SCRIPT_NAME is "elf" and $GENERATE_SHLIB_SCRIPT is set by the emulation | |
266 | # parameters too. | |
267 | ||
268 | if [ "x$SCRIPT_NAME" = "xelf" ]; then | |
269 | GENERATE_COMBRELOC_SCRIPT=yes | |
270 | fi | |
252b5132 | 271 | |
1ddd7b13 | 272 | SEGMENT_SIZE=${SEGMENT_SIZE-${MAXPAGESIZE-${TARGET_PAGE_SIZE}}} |
252b5132 RH |
273 | |
274 | # Determine DATA_ALIGNMENT for the 5 variants, using | |
8fbdf3ab | 275 | # values specified in the emulparams/<script_to_run>.sh file or default. |
252b5132 RH |
276 | |
277 | DATA_ALIGNMENT_="${DATA_ALIGNMENT_-${DATA_ALIGNMENT-ALIGN(${SEGMENT_SIZE})}}" | |
278 | DATA_ALIGNMENT_n="${DATA_ALIGNMENT_n-${DATA_ALIGNMENT_}}" | |
279 | DATA_ALIGNMENT_N="${DATA_ALIGNMENT_N-${DATA_ALIGNMENT-.}}" | |
280 | DATA_ALIGNMENT_r="${DATA_ALIGNMENT_r-${DATA_ALIGNMENT-}}" | |
281 | DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}" | |
282 | ||
283 | LD_FLAG=r | |
284 | DATA_ALIGNMENT=${DATA_ALIGNMENT_r} | |
285 | DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})" | |
cedd6b0d | 286 | ( echo "/* Script for ld -r: link without relocation */" |
f50230ae | 287 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 288 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 | 289 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xr |
252b5132 RH |
290 | |
291 | LD_FLAG=u | |
292 | DATA_ALIGNMENT=${DATA_ALIGNMENT_u} | |
293 | CONSTRUCTING=" " | |
cedd6b0d | 294 | ( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */" |
f50230ae | 295 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 296 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 | 297 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu |
252b5132 RH |
298 | |
299 | LD_FLAG= | |
300 | DATA_ALIGNMENT=${DATA_ALIGNMENT_} | |
301 | RELOCATING=" " | |
cedd6b0d | 302 | ( echo "/* Default linker script, for normal executables */" |
f50230ae | 303 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 304 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 | 305 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.x |
252b5132 RH |
306 | |
307 | LD_FLAG=n | |
308 | DATA_ALIGNMENT=${DATA_ALIGNMENT_n} | |
cedd6b0d | 309 | ( echo "/* Script for -n: mix text and data on same page */" |
f50230ae | 310 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 311 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 | 312 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xn |
252b5132 RH |
313 | |
314 | LD_FLAG=N | |
315 | DATA_ALIGNMENT=${DATA_ALIGNMENT_N} | |
cedd6b0d | 316 | ( echo "/* Script for -N: mix text and data on same page; don't align data */" |
f50230ae | 317 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 318 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 JJ |
319 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xbn |
320 | ||
321 | if test -n "$GENERATE_COMBRELOC_SCRIPT"; then | |
322 | DATA_ALIGNMENT=${DATA_ALIGNMENT_c-${DATA_ALIGNMENT_}} | |
323 | LD_FLAG=c | |
324 | COMBRELOC=ldscripts/${EMULATION_NAME}.xc.tmp | |
e24d7c12 | 325 | ( echo "/* Script for -z combreloc: combine and sort reloc sections */" |
f50230ae | 326 | . ${CUSTOMIZER_SCRIPT} |
db6751f2 JJ |
327 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
328 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xc | |
329 | rm -f ${COMBRELOC} | |
8c37241b JJ |
330 | LD_FLAG=w |
331 | RELRO_NOW=" " | |
332 | COMBRELOC=ldscripts/${EMULATION_NAME}.xw.tmp | |
333 | ( echo "/* Script for -z combreloc -z now -z relro: combine and sort reloc sections */" | |
f50230ae | 334 | . ${CUSTOMIZER_SCRIPT} |
8c37241b JJ |
335 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
336 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xw | |
337 | rm -f ${COMBRELOC} | |
db6751f2 | 338 | COMBRELOC= |
8c37241b | 339 | unset RELRO_NOW |
db6751f2 | 340 | fi |
252b5132 RH |
341 | |
342 | if test -n "$GENERATE_SHLIB_SCRIPT"; then | |
343 | LD_FLAG=shared | |
344 | DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}} | |
345 | CREATE_SHLIB=" " | |
cedd6b0d JB |
346 | ( |
347 | echo "/* Script for ld --shared: link shared library */" | |
f50230ae | 348 | . ${CUSTOMIZER_SCRIPT} |
179c732c | 349 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
db6751f2 JJ |
350 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xs |
351 | if test -n "$GENERATE_COMBRELOC_SCRIPT"; then | |
352 | LD_FLAG=cshared | |
353 | DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}} | |
8c37241b | 354 | COMBRELOC=ldscripts/${EMULATION_NAME}.xsc.tmp |
cedd6b0d | 355 | ( echo "/* Script for --shared -z combreloc: shared library, combine & sort relocs */" |
f50230ae | 356 | . ${CUSTOMIZER_SCRIPT} |
db6751f2 JJ |
357 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
358 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsc | |
359 | rm -f ${COMBRELOC} | |
8c37241b JJ |
360 | LD_FLAG=wshared |
361 | RELRO_NOW=" " | |
362 | COMBRELOC=ldscripts/${EMULATION_NAME}.xsw.tmp | |
363 | ( echo "/* Script for --shared -z combreloc -z now -z relro: shared library, combine & sort relocs */" | |
f50230ae | 364 | . ${CUSTOMIZER_SCRIPT} |
8c37241b JJ |
365 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
366 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsw | |
367 | rm -f ${COMBRELOC} | |
db6751f2 | 368 | COMBRELOC= |
8c37241b | 369 | unset RELRO_NOW |
db6751f2 | 370 | fi |
36af4a4e JJ |
371 | unset CREATE_SHLIB |
372 | fi | |
373 | ||
374 | if test -n "$GENERATE_PIE_SCRIPT"; then | |
375 | LD_FLAG=pie | |
376 | DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}} | |
377 | CREATE_PIE=" " | |
36af4a4e JJ |
378 | ( |
379 | echo "/* Script for ld -pie: link position independent executable */" | |
f50230ae | 380 | . ${CUSTOMIZER_SCRIPT} |
36af4a4e JJ |
381 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
382 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xd | |
383 | if test -n "$GENERATE_COMBRELOC_SCRIPT"; then | |
384 | LD_FLAG=cpie | |
385 | DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}} | |
8c37241b | 386 | COMBRELOC=ldscripts/${EMULATION_NAME}.xdc.tmp |
36af4a4e | 387 | ( echo "/* Script for -pie -z combreloc: position independent executable, combine & sort relocs */" |
f50230ae | 388 | . ${CUSTOMIZER_SCRIPT} |
36af4a4e JJ |
389 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
390 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdc | |
391 | rm -f ${COMBRELOC} | |
8c37241b JJ |
392 | LD_FLAG=wpie |
393 | RELRO_NOW=" " | |
394 | COMBRELOC=ldscripts/${EMULATION_NAME}.xdw.tmp | |
395 | ( echo "/* Script for -pie -z combreloc -z now -z relro: position independent executable, combine & sort relocs */" | |
f50230ae | 396 | . ${CUSTOMIZER_SCRIPT} |
8c37241b JJ |
397 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
398 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdw | |
399 | rm -f ${COMBRELOC} | |
36af4a4e | 400 | COMBRELOC= |
8c37241b | 401 | unset RELRO_NOW |
36af4a4e JJ |
402 | fi |
403 | unset CREATE_PIE | |
252b5132 RH |
404 | fi |
405 | ||
e2a83dd0 NC |
406 | if test -n "$GENERATE_AUTO_IMPORT_SCRIPT"; then |
407 | LD_FLAG=auto_import | |
408 | DATA_ALIGNMENT=${DATA_ALIGNMENT_} | |
409 | ( | |
410 | echo "/* Script for ld --enable-auto-import: Like the default script except read only data is placed into .data */" | |
f50230ae | 411 | . ${CUSTOMIZER_SCRIPT} |
e2a83dd0 NC |
412 | . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc |
413 | ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xa | |
414 | fi | |
415 | ||
7225345d AM |
416 | case "$COMPILE_IN: $EMULATION_LIBPATH " in |
417 | :*" ${EMULATION_NAME} "*) COMPILE_IN=yes;; | |
eb3d6bb8 | 418 | esac |
252b5132 | 419 | |
6e73d595 NC |
420 | # PR ld/5652: |
421 | # Determine if the shell has support for the variable BASH_LINENO. | |
422 | # When it is the case, it is only available inside functions. | |
423 | has_lineno() | |
424 | { | |
425 | test "x$BASH_LINENO" != "x" | |
426 | } | |
427 | ||
428 | # Enable accruate error source in the compiler error messages, if possible. | |
429 | if has_lineno; then | |
c43cc9ff | 430 | . ${srcdir}/genscrba.sh |
92b93329 RM |
431 | else |
432 | source_em() | |
433 | { | |
434 | . $1 | |
435 | } | |
436 | fragment() | |
437 | { | |
438 | cat >> e${EMULATION_NAME}.c | |
439 | } | |
440 | fi | |
441 | ||
252b5132 | 442 | # Generate e${EMULATION_NAME}.c. |
92b93329 RM |
443 | # Start with an empty file, then the sourced .em script |
444 | # can use the "fragment" function to append. | |
445 | > e${EMULATION_NAME}.c | |
446 | source_em ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em |