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