aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2007-07-19 19:56:10 +0000
committerRoland McGrath <roland@gnu.org>2007-07-19 19:56:10 +0000
commit92b93329b58c744ea269b50f6278ed99416941a9 (patch)
tree415eaf8c24ce53fd9cdab8ed6af4f5cd6fdd1ede /ld/emultempl
parent6b33789f617a22563c87282673aa23d9b8b4a3ca (diff)
downloadgdb-92b93329b58c744ea269b50f6278ed99416941a9.zip
gdb-92b93329b58c744ea269b50f6278ed99416941a9.tar.gz
gdb-92b93329b58c744ea269b50f6278ed99416941a9.tar.bz2
2007-07-19 Roland McGrath <roland@redhat.com>
* genscripts.sh (source_em, fragment): New sh functions. Truncate e${EMULATION_NAME}.c file before .em script fills it. Use source_em in place of . for the .em script. * emultempl/generic.em: Use fragment and source_em functions. * emultempl/aix.em: Likewise. * emultempl/alphaelf.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/cr16elf.em: Likewise. * emultempl/crxelf.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/genelf.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/ia64elf.em: Likewise. * emultempl/irix.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/m68kelf.em: Likewise. * emultempl/mipsecoff.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmixelf.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/needrelax.em: Likewise. * emultempl/netbsd.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/vxworks.em: Likewise. * emultempl/xtensaelf.em: Likewise. * emultempl/z80.em: Likewise.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aix.em8
-rw-r--r--ld/emultempl/alphaelf.em2
-rw-r--r--ld/emultempl/armcoff.em8
-rw-r--r--ld/emultempl/armelf.em4
-rw-r--r--ld/emultempl/avrelf.em22
-rw-r--r--ld/emultempl/beos.em6
-rw-r--r--ld/emultempl/cr16elf.em3
-rw-r--r--ld/emultempl/crxelf.em3
-rw-r--r--ld/emultempl/elf-generic.em2
-rw-r--r--ld/emultempl/elf32.em122
-rw-r--r--ld/emultempl/genelf.em6
-rw-r--r--ld/emultempl/generic.em14
-rw-r--r--ld/emultempl/gld960.em8
-rw-r--r--ld/emultempl/gld960c.em8
-rw-r--r--ld/emultempl/hppaelf.em2
-rw-r--r--ld/emultempl/ia64elf.em4
-rw-r--r--ld/emultempl/irix.em4
-rw-r--r--ld/emultempl/linux.em8
-rw-r--r--ld/emultempl/lnk960.em8
-rw-r--r--ld/emultempl/m68hc1xelf.em2
-rw-r--r--ld/emultempl/m68kcoff.em8
-rw-r--r--ld/emultempl/m68kelf.em2
-rw-r--r--ld/emultempl/mipsecoff.em2
-rw-r--r--ld/emultempl/mipself.em2
-rw-r--r--ld/emultempl/mmix-elfnmmo.em2
-rw-r--r--ld/emultempl/mmixelf.em4
-rw-r--r--ld/emultempl/mmo.em8
-rw-r--r--ld/emultempl/needrelax.em2
-rw-r--r--ld/emultempl/netbsd.em2
-rw-r--r--ld/emultempl/pe.em14
-rw-r--r--ld/emultempl/pep.em12
-rw-r--r--ld/emultempl/ppc32elf.em4
-rw-r--r--ld/emultempl/ppc64elf.em4
-rw-r--r--ld/emultempl/scoreelf.em5
-rw-r--r--ld/emultempl/sh64elf.em2
-rw-r--r--ld/emultempl/spuelf.em6
-rw-r--r--ld/emultempl/sunos.em16
-rw-r--r--ld/emultempl/ticoff.em8
-rw-r--r--ld/emultempl/vanilla.em2
-rw-r--r--ld/emultempl/vxworks.em6
-rw-r--r--ld/emultempl/xtensaelf.em29
-rw-r--r--ld/emultempl/z80.em16
42 files changed, 198 insertions, 202 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index df983b1..9aa0d50 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ${EMULATION_NAME}
@@ -1271,7 +1271,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f ${srcdir}/emultempl/ostring.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -1292,7 +1292,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -1311,7 +1311,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_create_output_section_statements (void)
diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
index fccfc1e..6ac460b 100644
--- a/ld/emultempl/alphaelf.em
+++ b/ld/emultempl/alphaelf.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra alpha
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "elf/internal.h"
#include "elf/alpha.h"
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index d258acc..6380e4b 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
@@ -210,7 +210,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -231,7 +231,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -250,7 +250,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 325ad23..8ce0dab 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -25,7 +25,7 @@
# specific routines.
#
test -z "$TARGET2_TYPE" && TARGET2_TYPE="rel"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "elf/arm.h"
@@ -326,7 +326,7 @@ PARSE_AND_LIST_ARGS_CASES='
case OPTION_USE_BLX:
use_blx = 1;
break;
-
+
case OPTION_VFP11_DENORM_FIX:
if (strcmp (optarg, "none") == 0)
vfp11_denorm_fix = BFD_ARM_VFP11_FIX_NONE;
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index 9f24f18..2f17ec9 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -25,12 +25,12 @@
# of devices where one needs to address the issue that it is not possible
# to reach the whole program memory by using 16 bit pointers.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "elf32-avr.h"
#include "ldctor.h"
-/* The fake file and it's corresponding section meant to hold
+/* The fake file and it's corresponding section meant to hold
the linker stubs if needed. */
static lang_input_statement_type *stub_file;
@@ -126,14 +126,14 @@ avr_elf_create_output_section_statements (void)
".trampolines");
if (avr_stub_section == NULL)
goto err_ret;
-
+
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
| SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
if (!bfd_set_section_flags (stub_file->the_bfd, avr_stub_section, flags))
goto err_ret;
avr_stub_section->alignment_power = 1;
-
+
ldlang_add_file (stub_file);
return;
@@ -147,7 +147,7 @@ avr_elf_create_output_section_statements (void)
static void
avr_elf_finish (void)
-{
+{
if (!avr_no_stubs)
{
/* Now build the linker stubs. */
@@ -185,15 +185,15 @@ PARSE_AND_LIST_PROLOGUE='
'
PARSE_AND_LIST_LONGOPTS='
- { "no-call-ret-replacement", no_argument,
+ { "no-call-ret-replacement", no_argument,
NULL, OPTION_NO_CALL_RET_REPLACEMENT},
- { "pmem-wrap-around", required_argument,
+ { "pmem-wrap-around", required_argument,
NULL, OPTION_PMEM_WRAP_AROUND},
- { "no-stubs", no_argument,
+ { "no-stubs", no_argument,
NULL, OPTION_NO_STUBS},
- { "debug-stubs", no_argument,
+ { "debug-stubs", no_argument,
NULL, OPTION_DEBUG_STUBS},
- { "debug-relax", no_argument,
+ { "debug-relax", no_argument,
NULL, OPTION_DEBUG_RELAX},
'
@@ -227,7 +227,7 @@ PARSE_AND_LIST_OPTIONS='
PARSE_AND_LIST_ARGS_CASES='
case OPTION_PMEM_WRAP_AROUND:
- {
+ {
/* This variable is defined in the bfd library. */
if ((!strcmp (optarg,"32k")) || (!strcmp (optarg,"32K")))
avr_pc_wrap_around = 32768;
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 34becad..23d3849 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
@@ -737,7 +737,7 @@ EOF
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -755,7 +755,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em
index 699903b..fd1a2ed 100644
--- a/ld/emultempl/cr16elf.em
+++ b/ld/emultempl/cr16elf.em
@@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra cr16-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
@@ -90,4 +90,3 @@ PARSE_AND_LIST_ARGS_CASES='
#
LDEMUL_AFTER_PARSE=cr16elf_after_parse
LDEMUL_BEFORE_ALLOCATION=cr16elf_before_allocation
-
diff --git a/ld/emultempl/crxelf.em b/ld/emultempl/crxelf.em
index 2931ff0..d306fd6 100644
--- a/ld/emultempl/crxelf.em
+++ b/ld/emultempl/crxelf.em
@@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra crx-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
@@ -92,4 +92,3 @@ PARSE_AND_LIST_ARGS_CASES='
#
LDEMUL_AFTER_PARSE=crxelf_after_parse
LDEMUL_BEFORE_ALLOCATION=crxelf_before_allocation
-
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em
index f3cd9e0..94486f8 100644
--- a/ld/emultempl/elf-generic.em
+++ b/ld/emultempl/elf-generic.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em and from ELF targets that use
# generic.em.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index a3af5ca..6261e1d 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -8,7 +8,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
@@ -70,7 +70,7 @@ EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then
case ${target} in
*-*-linux-* | *-*-k*bsd*-*)
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
#ifdef HAVE_GLOB
#include <glob.h>
#endif
@@ -81,9 +81,9 @@ fi
# Import any needed special functions and/or overrides.
#
-. ${srcdir}/emultempl/elf-generic.em
+source_em ${srcdir}/emultempl/elf-generic.em
if test -n "$EXTRA_EM_FILE" ; then
-. ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
+ source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
fi
# Functions in this file can be overridden by setting the LDEMUL_* shell
@@ -93,7 +93,7 @@ fi
# as presumably it is called from the overriding function.
#
if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_before_parse (void)
@@ -107,7 +107,7 @@ EOF
fi
if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Handle as_needed DT_NEEDED. */
static bfd_boolean
@@ -144,7 +144,7 @@ gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* These variables are required to pass information back and forth
between after_open and check_needed and stat_needed and vercheck. */
@@ -363,7 +363,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
EOF
case ${target} in
*-*-linux-* | *-*-k*bsd*-*)
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
{
struct bfd_link_needed_list *l;
@@ -380,7 +380,7 @@ case ${target} in
EOF
;;
esac
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
}
}
@@ -493,7 +493,7 @@ gld${EMULATION_NAME}_search_needed (const char *path,
EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
/* Add the sysroot to every entry in a path separated by
config.rpath_separator. */
@@ -536,7 +536,7 @@ gld${EMULATION_NAME}_add_sysroot (const char *path)
EOF
case ${target} in
*-*-freebsd* | *-*-dragonfly*)
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
/* Read the system search path the FreeBSD way rather than the Linux way. */
#ifdef HAVE_ELF_HINTS_H
#include <elf-hints.h>
@@ -598,7 +598,7 @@ EOF
;;
*-*-linux-* | *-*-k*bsd*-*)
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
/* For a native linker, check the file /etc/ld.so.conf for directories
in which we may find shared libraries. /etc/ld.so.conf is really
only meaningful on Linux. */
@@ -808,7 +808,7 @@ EOF
;;
esac
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* See if an input file matches a DT_NEEDED entry by name. */
@@ -860,7 +860,7 @@ gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s)
EOF
if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static bfd_size_type
gld${EMULATION_NAME}_id_note_section_size (bfd *abfd,
@@ -1188,31 +1188,31 @@ gld${EMULATION_NAME}_after_open (void)
search_dirs_type *search;
EOF
if [ "x${NATIVE}" = xyes ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
const char *lib_path;
EOF
fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct bfd_link_needed_list *rp;
int found;
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
&n, force))
break;
EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
&n, force))
break;
EOF
fi
if [ "x${NATIVE}" = xyes ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
if (command_line.rpath_link == NULL
&& command_line.rpath == NULL)
{
@@ -1227,7 +1227,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
found = 0;
rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next)
@@ -1247,7 +1247,7 @@ fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
case ${target} in
*-*-freebsd* | *-*-dragonfly*)
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
break;
EOF
@@ -1256,7 +1256,7 @@ EOF
*-*-linux-* | *-*-k*bsd*-*)
# Linux
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
break;
@@ -1264,7 +1264,7 @@ EOF
;;
esac
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
len = strlen (l->name);
for (search = search_head; search != NULL; search = search->next)
{
@@ -1282,7 +1282,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
if (search != NULL)
break;
EOF
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
}
if (force < 2)
@@ -1296,7 +1296,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Look through an expression for an assignment statement. */
@@ -1377,7 +1377,7 @@ if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation;
else
ELF_INTERPRETER_SET_DEFAULT=
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This is called after the sections have been attached to output
sections, but before any sizes or addresses have been set. */
@@ -1478,7 +1478,7 @@ EOF
fi
if test x"$LDEMUL_OPEN_DYNAMIC_ARCHIVE" != xgld"$EMULATION_NAME"_open_dynamic_archive; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Try to open a dynamic archive. This is where we know that ELF
dynamic libraries have an extension of .so (or .sl on oddball systems
@@ -1557,7 +1557,7 @@ EOF
fi
if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* A variant of lang_output_section_find used by place_orphan. */
@@ -1807,7 +1807,7 @@ EOF
fi
if test x"$LDEMUL_FINISH" != xgld"$EMULATION_NAME"_finish; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_finish (void)
@@ -1821,7 +1821,7 @@ EOF
fi
if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static char *
gld${EMULATION_NAME}_get_script (int *isfile)
@@ -1834,7 +1834,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -1888,7 +1888,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -1901,14 +1901,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then :
else
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (!config.magic_demand_paged)
return "ldscripts/${EMULATION_NAME}.xn";
EOF
fi
if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (link_info.pie && link_info.combreloc
&& link_info.relro && (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xdw";
@@ -1916,14 +1916,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xdc";
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (link_info.pie)
return "ldscripts/${EMULATION_NAME}.xd";
EOF
fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (link_info.shared && link_info.combreloc
&& link_info.relro && (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xsw";
@@ -1931,13 +1931,13 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xsc";
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (link_info.shared)
return "ldscripts/${EMULATION_NAME}.xs";
EOF
fi
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (link_info.combreloc && link_info.relro
&& (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xw";
@@ -1945,7 +1945,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xc";
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else
return "ldscripts/${EMULATION_NAME}.x";
}
@@ -1957,12 +1957,12 @@ fi
if test -n "$PARSE_AND_LIST_ARGS_CASES" -o x"$GENERATE_SHLIB_SCRIPT" = xyes; then
if test -n "$PARSE_AND_LIST_PROLOGUE" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
$PARSE_AND_LIST_PROLOGUE
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#define OPTION_DISABLE_NEW_DTAGS (400)
#define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1)
@@ -1983,7 +1983,7 @@ gld${EMULATION_NAME}_add_options
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
{"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
{"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR},
@@ -1994,12 +1994,12 @@ EOF
fi
if test -n "$PARSE_AND_LIST_LONGOPTS" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
$PARSE_AND_LIST_LONGOPTS
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{NULL, no_argument, NULL, 0}
};
@@ -2035,7 +2035,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
case OPTION_DISABLE_NEW_DTAGS:
link_info.new_dtags = FALSE;
break;
@@ -2128,7 +2128,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
if test -n "$COMMONPAGESIZE"; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (strcmp (optarg, "relro") == 0)
link_info.relro = TRUE;
else if (strcmp (optarg, "norelro") == 0)
@@ -2136,7 +2136,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
else if (CONST_STRNEQ (optarg, "max-page-size="))
{
char *end;
@@ -2166,12 +2166,12 @@ EOF
fi
if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
$PARSE_AND_LIST_ARGS_CASES
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
}
return TRUE;
@@ -2180,7 +2180,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_list_options (FILE * file)
@@ -2189,7 +2189,7 @@ gld${EMULATION_NAME}_list_options (FILE * file)
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
fprintf (file, _(" -Bgroup\t\tSelects group name lookup rules for DSO\n"));
fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n"));
fprintf (file, _(" --enable-new-dtags\tEnable new dynamic tags\n"));
@@ -2213,23 +2213,23 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
if test -n "$COMMONPAGESIZE"; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
fprintf (file, _(" -z norelro\t\tDon't create RELRO program header\n"));
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n"));
fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t at runtime\n"));
EOF
if test -n "$COMMONPAGESIZE"; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
fprintf (file, _(" -z relro\t\tCreate RELRO program header\n"));
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
fprintf (file, _(" -z max-page-size=SIZE\tSet maximum page size to SIZE\n"));
fprintf (file, _(" -z common-page-size=SIZE\n\t\t\tSet common page size to SIZE\n"));
fprintf (file, _(" -z KEYWORD\t\tIgnored for Solaris compatibility\n"));
@@ -2237,34 +2237,34 @@ EOF
fi
if test -n "$PARSE_AND_LIST_OPTIONS" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
$PARSE_AND_LIST_OPTIONS
EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
}
EOF
if test -n "$PARSE_AND_LIST_EPILOGUE" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
$PARSE_AND_LIST_EPILOGUE
EOF
fi
fi
else
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#define gld${EMULATION_NAME}_add_options NULL
#define gld${EMULATION_NAME}_handle_option NULL
EOF
if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#define gld${EMULATION_NAME}_list_options NULL
EOF
fi
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/genelf.em b/ld/emultempl/genelf.em
index c6db287..e44bb9b 100644
--- a/ld/emultempl/genelf.em
+++ b/ld/emultempl/genelf.em
@@ -21,12 +21,12 @@
# This file is sourced from generic.em
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "elf-bfd.h"
EOF
-. ${srcdir}/emultempl/elf-generic.em
-cat >>e${EMULATION_NAME}.c <<EOF
+source_em ${srcdir}/emultempl/elf-generic.em
+fragment <<EOF
static void
gld${EMULATION_NAME}_finish (void)
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index 35621c3..048ebbd 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
@@ -45,11 +45,11 @@ EOF
# Import any needed special functions and/or overrides.
#
if test -n "$EXTRA_EM_FILE" ; then
-. ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
+ source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
fi
if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_before_parse (void)
@@ -63,7 +63,7 @@ EOF
fi
if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static char *
gld${EMULATION_NAME}_get_script (int *isfile)
@@ -76,7 +76,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -97,7 +97,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -116,7 +116,7 @@ EOF
fi
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index 900d9b6..2669c0e 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
@@ -80,7 +80,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -101,7 +101,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -120,7 +120,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_gld960_emulation =
{
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index f8a8dea..1999ea8 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2007 Free Software Foundation, Inc.
@@ -94,7 +94,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -115,7 +115,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -134,7 +134,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_gld960coff_emulation =
{
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 703e820..f1e1c45 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra hppa-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
#include "elf32-hppa.h"
diff --git a/ld/emultempl/ia64elf.em b/ld/emultempl/ia64elf.em
index 828560e..d562417 100644
--- a/ld/emultempl/ia64elf.em
+++ b/ld/emultempl/ia64elf.em
@@ -25,7 +25,7 @@
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* None zero if generating binary for Intel Itanium processor. */
static int itanium = 0;
@@ -60,4 +60,4 @@ PARSE_AND_LIST_ARGS_CASES='
'
LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
-. ${srcdir}/emultempl/needrelax.em
+source_em ${srcdir}/emultempl/needrelax.em
diff --git a/ld/emultempl/irix.em b/ld/emultempl/irix.em
index dcac947..b4a8f4e 100644
--- a/ld/emultempl/irix.em
+++ b/ld/emultempl/irix.em
@@ -19,7 +19,7 @@
# MA 02110-1301, USA.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ld.h"
#include "ldmain.h"
@@ -40,4 +40,4 @@ irix_after_open (void)
EOF
LDEMUL_AFTER_OPEN=irix_after_open
-. "${srcdir}/emultempl/mipself.em"
+source_em "${srcdir}/emultempl/mipself.em"
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index 9209c1a..aa4a088 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Linux a.out emulation code for ${EMULATION_NAME}
@@ -137,7 +137,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -158,7 +158,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -177,7 +177,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index e3b2d50..1e9e755 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* intel coff loader emulation specific stuff
Copyright 1991, 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
2005, 2007 Free Software Foundation, Inc.
@@ -217,7 +217,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -238,7 +238,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -257,7 +257,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_lnk960_emulation =
{
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index 1f0a3ee..03a0500 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -40,7 +40,7 @@
#
# Copied from hppaelf and adapted for M68HC11/M68HC12 specific needs.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
#include "elf32-m68hc1x.h"
diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em
index 11c6aba..a79eb2c 100644
--- a/ld/emultempl/m68kcoff.em
+++ b/ld/emultempl/m68kcoff.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Handle embedded relocs for m68k.
@@ -171,7 +171,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -192,7 +192,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -211,7 +211,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index cb64d85..d6a1d8a 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -31,7 +31,7 @@ case ${target} in
;;
esac
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#ifdef SUPPORT_EMBEDDED_RELOCS
static void check_sections (bfd *, asection *, void *);
diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em
index 1e6d060..75a943a 100644
--- a/ld/emultempl/mipsecoff.em
+++ b/ld/emultempl/mipsecoff.em
@@ -25,7 +25,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_before_parse (void)
{
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index a850610..e7a1be8 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
mips_after_parse (void)
{
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index eb93235..9957268 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em and mmo.em, used to define
# MMIX-specific things common to ELF and MMO.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "elf/mmix.h"
/* Set up handling of linker-allocated global registers. */
diff --git a/ld/emultempl/mmixelf.em b/ld/emultempl/mmixelf.em
index 855f8fc..314f560 100644
--- a/ld/emultempl/mmixelf.em
+++ b/ld/emultempl/mmixelf.em
@@ -22,9 +22,9 @@
# This file is sourced from elf32.em and used to define MMIX and ELF
# specific things. First include what we have in common with mmo.
-. ${srcdir}/emultempl/mmix-elfnmmo.em
+source_em ${srcdir}/emultempl/mmix-elfnmmo.em
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
elfmmix_before_parse (void)
diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em
index 6607347..8c46577 100644
--- a/ld/emultempl/mmo.em
+++ b/ld/emultempl/mmo.em
@@ -21,7 +21,7 @@
# This file is sourced from generic.em.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Need to have this macro defined before mmix-elfnmmo, which uses the
name for the before_allocation function, defined in ldemul.c (for
the mmo "emulation") or in elf32.em (for the elf64mmix
@@ -36,10 +36,10 @@ cat >>e${EMULATION_NAME}.c <<EOF
#include "elf-bfd.h"
EOF
-. ${srcdir}/emultempl/elf-generic.em
-. ${srcdir}/emultempl/mmix-elfnmmo.em
+source_em ${srcdir}/emultempl/elf-generic.em
+source_em ${srcdir}/emultempl/mmix-elfnmmo.em
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Place an orphan section. We use this to put random SEC_CODE or
SEC_READONLY sections right after MMO_TEXT_SECTION_NAME. Much borrowed
diff --git a/ld/emultempl/needrelax.em b/ld/emultempl/needrelax.em
index 6eb9576..c0d5928 100644
--- a/ld/emultempl/needrelax.em
+++ b/ld/emultempl/needrelax.em
@@ -24,7 +24,7 @@
LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
need_relax_${EMULATION_NAME}_before_allocation (void)
diff --git a/ld/emultempl/netbsd.em b/ld/emultempl/netbsd.em
index 2015823..6e25486 100644
--- a/ld/emultempl/netbsd.em
+++ b/ld/emultempl/netbsd.em
@@ -21,7 +21,7 @@
LDEMUL_BEFORE_PARSE=gldnetbsd_before_parse
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_before_parse (void);
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9dd070a..ddee011 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -8,7 +8,7 @@ else
fi
rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
@@ -51,7 +51,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
#define bfd_arm_process_before_allocation \
bfd_${EMULATION_NAME}_process_before_allocation
#endif
-
+
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
@@ -1287,7 +1287,7 @@ gld_${EMULATION_NAME}_after_open (void)
if ((sec->flags & SEC_CODE) && sec->reloc_count)
stub_sec = sec;
}
-
+
if (is_imp && stub_sec)
{
long symsize;
@@ -1780,7 +1780,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
For backwards compatibility, libfoo.a needs to precede
libfoo.dll and foo.dll in the search. */
{ "lib%s.a", FALSE },
- /* The 'native' spelling of an import lib name is "foo.lib". */
+ /* The 'native' spelling of an import lib name is "foo.lib". */
{ "%s.lib", FALSE },
#ifdef DLL_SUPPORT
/* Try "<prefix>foo.dll" (preferred dll name, if specified). */
@@ -1837,7 +1837,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
for (i = 0; libname_fmt[i].format; i++)
{
-#ifdef DLL_SUPPORT
+#ifdef DLL_SUPPORT
if (libname_fmt[i].use_prefix)
{
if (!pe_dll_search_prefix)
@@ -1877,7 +1877,7 @@ EOF
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -1895,7 +1895,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index e26dfb2..6a21bc7 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -8,8 +8,8 @@ else
fi
rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
-cat >>e${EMULATION_NAME}.c <<EOF
-/* Copyright 2006, 2007 Free Software Foundation, Inc.
+fragment <<EOF
+/* Copyright 2006, 2007 Free Software Foundation, Inc.
Written by Kai Tietz, OneVision Software GmbH&CoKg.
This file is part of the GNU Binutils.
@@ -1559,7 +1559,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
For backwards compatibility, libfoo.a needs to precede
libfoo.dll and foo.dll in the search. */
{ "lib%s.a", FALSE },
- /* The 'native' spelling of an import lib name is "foo.lib". */
+ /* The 'native' spelling of an import lib name is "foo.lib". */
{ "%s.lib", FALSE },
#ifdef DLL_SUPPORT
/* Try "<prefix>foo.dll" (preferred dll name, if specified). */
@@ -1616,7 +1616,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
for (i = 0; libname_fmt[i].format; i++)
{
-#ifdef DLL_SUPPORT
+#ifdef DLL_SUPPORT
if (libname_fmt[i].use_prefix)
{
if (!pep_dll_search_prefix)
@@ -1656,7 +1656,7 @@ EOF
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -1674,7 +1674,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index d28b9a6..0b8d887 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra powerpc32-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "libbfd.h"
#include "elf32-ppc.h"
@@ -126,7 +126,7 @@ ppc_before_allocation (void)
EOF
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
/* Special handling for embedded SPU executables. */
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index fd27e1b..40e5891 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra powerpc64-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
#include "libbfd.h"
@@ -466,7 +466,7 @@ ppc_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
EOF
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
/* Special handling for embedded SPU executables. */
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index b3d5022..72c17d4 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2006, 2007 Free Software Foundation, Inc.
-# Contributed by:
+# Contributed by:
# Mei Ligang (ligang@sunnorth.com.cn)
# Pei-Lin Tsai (pltsai@sunplus.com)
@@ -25,7 +25,7 @@
# This file is sourced from elf32.em, and defines extra score-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static void
gld${EMULATION_NAME}_before_parse ()
@@ -71,4 +71,3 @@ LDEMUL_AFTER_OPEN=score_elf_after_open
# Replace the elf before_parse function with our own.
LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
-
diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em
index 30dd68f..0433cf9 100644
--- a/ld/emultempl/sh64elf.em
+++ b/ld/emultempl/sh64elf.em
@@ -26,7 +26,7 @@
LDEMUL_AFTER_ALLOCATION=sh64_elf_${EMULATION_NAME}_after_allocation
LDEMUL_BEFORE_ALLOCATION=sh64_elf_${EMULATION_NAME}_before_allocation
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "libiberty.h"
#include "libbfd.h"
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index 2235143..ccbc0f7 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra spu specific
# features.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include "ldctor.h"
#include "elf32-spu.h"
@@ -50,7 +50,7 @@ EOF
../binutils/bin2c < ${srcdir}/emultempl/spu_ovl.o >> e${EMULATION_NAME}.c
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
};
static const struct _ovl_stream ovl_mgr_stream = {
@@ -247,7 +247,7 @@ gld${EMULATION_NAME}_finish (void)
EOF
if grep -q 'ld_elf.*ppc.*_emulation' ldemul-list.h; then
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
#include "filenames.h"
#include <fcntl.h>
#include <sys/wait.h>
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 2aa2352..00d949f 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* SunOS emulation code for ${EMULATION_NAME}
@@ -101,7 +101,7 @@ EOF
if [ "x${host}" = "x${target}" ] ; then
case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*)
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
const char *env;
env = (const char *) getenv ("LD_LIBRARY_PATH");
@@ -128,7 +128,7 @@ EOF
;;
esac
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
}
/* Despite the name, we use this routine to search for dynamic
@@ -464,7 +464,7 @@ EOF
if [ "x${host}" = "x${target}" ] ; then
case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*)
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
const char *lib_path;
@@ -476,7 +476,7 @@ EOF
;;
esac
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
if (command_line.rpath != NULL)
{
for (search = search_head; search != NULL; search = search->next)
@@ -961,7 +961,7 @@ then
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
@@ -982,7 +982,7 @@ echo '; }' >> e${EMULATION_NAME}
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -1001,7 +1001,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 003a666..8860d5a 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
(echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1999, 2000, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
@@ -116,7 +116,7 @@ s/$/\\n\\/
1s/^/"/
$s/$/n"/
'
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 0;
if (link_info.relocatable && config.build_constructors)
@@ -135,7 +135,7 @@ EOF
else
# Scripts read from the filesystem.
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
{
*isfile = 1;
@@ -154,7 +154,7 @@ EOF
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
gld_${EMULATION_NAME}_before_parse,
diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
index 2e26bd3..8ed2a5a 100644
--- a/ld/emultempl/vanilla.em
+++ b/ld/emultempl/vanilla.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* A vanilla emulation with no defaults
Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em
index e6131bb..f6ad0b6 100644
--- a/ld/emultempl/vxworks.em
+++ b/ld/emultempl/vxworks.em
@@ -20,10 +20,10 @@
#
if test -n "$VXWORKS_BASE_EM_FILE" ; then
-. "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
+ source_em "${srcdir}/emultempl/${VXWORKS_BASE_EM_FILE}.em"
fi
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
static int force_dynamic;
@@ -93,7 +93,7 @@ for override in before_parse after_open; do
var="LDEMUL_`echo ${override} | tr a-z A-Z`"
eval value=\$${var}
if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
- cat >>e${EMULATION_NAME}.c <<EOF
+ fragment <<EOF
#define ${value} vxworks_${override}
EOF
else
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index 04f870a..04406a6 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra xtensa-elf
# specific routines.
#
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
#include <xtensa-config.h>
#include "../bfd/elf-bfd.h"
@@ -104,7 +104,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs = NULL;
unsigned reloc_count;
-
+
*error_message = "";
insn_sec = bfd_get_section_by_name (abfd, insn_sec_name);
if (insn_sec == NULL)
@@ -117,7 +117,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
*error_message = _("file already has property tables");
return FALSE;
}
-
+
if (insn_sec->size != 0)
{
insn_contents = (bfd_byte *) bfd_malloc (insn_sec->size);
@@ -144,7 +144,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
*error_message = _("could not create new section");
goto cleanup;
}
-
+
prop_sec->size = entry_count * 12;
prop_contents = (bfd_byte *) bfd_zalloc (abfd, prop_sec->size);
elf_section_data (prop_sec)->this_hdr.contents = prop_contents;
@@ -153,7 +153,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
the number of relocations since it does not use reloc_count. */
elf_section_data (prop_sec)->rel_hdr.sh_entsize =
sizeof (Elf32_External_Rela);
- elf_section_data (prop_sec)->rel_hdr.sh_size =
+ elf_section_data (prop_sec)->rel_hdr.sh_size =
elf_section_data (insn_sec)->rel_hdr.sh_size;
if (prop_contents == NULL && prop_sec->size != 0)
@@ -169,12 +169,12 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
/* If there is already an internal_reloc, then save it so that the
read_relocs function freshly allocates a copy. */
Elf_Internal_Rela *saved_relocs = elf_section_data (insn_sec)->relocs;
-
+
elf_section_data (insn_sec)->relocs = NULL;
- internal_relocs =
+ internal_relocs =
_bfd_elf_link_read_relocs (abfd, insn_sec, NULL, NULL, FALSE);
elf_section_data (insn_sec)->relocs = saved_relocs;
-
+
if (internal_relocs == NULL)
{
*error_message = _("out of memory");
@@ -188,7 +188,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
elf_section_data (prop_sec)->relocs = internal_relocs;
prop_sec->reloc_count = reloc_count;
}
-
+
/* Now copy each insn table entry to the prop table entry with
appropriate flags. */
for (entry = 0; entry < entry_count; ++entry)
@@ -218,7 +218,7 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
rela = &internal_relocs[i];
- /* If this relocation is to the .xt.insn section,
+ /* If this relocation is to the .xt.insn section,
change the section number and the offset. */
r_offset = rela->r_offset;
r_offset += 4 * (r_offset / 8);
@@ -227,10 +227,10 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
}
remove_section (abfd, insn_sec);
-
+
if (insn_contents)
free (insn_contents);
-
+
return TRUE;
cleanup:
@@ -258,7 +258,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec)
char *prop_sec_name = NULL;
char *owned_prop_sec_name = NULL;
const char *sec_name;
-
+
sec_name = bfd_get_section_name (abfd, sec);
if (strcmp (sec_name, INSN_SEC_BASE_NAME) == 0)
{
@@ -297,7 +297,7 @@ elf_xtensa_after_open (void)
{
/* First call the ELF version. */
gld${EMULATION_NAME}_after_open ();
-
+
/* Now search the input files looking for instruction table sections. */
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
@@ -2024,4 +2024,3 @@ LDEMUL_BEFORE_PARSE=elf_xtensa_before_parse
LDEMUL_AFTER_OPEN=elf_xtensa_after_open
LDEMUL_CHOOSE_TARGET=elf_xtensa_choose_target
LDEMUL_BEFORE_ALLOCATION=elf_xtensa_before_allocation
-
diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em
index 98b4578..7b17e8f 100644
--- a/ld/emultempl/z80.em
+++ b/ld/emultempl/z80.em
@@ -23,7 +23,7 @@ LDEMUL_BEFORE_PARSE=gldz80_before_parse
LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file
LDEMUL_AFTER_OPEN=gldz80_after_open
-cat >>e${EMULATION_NAME}.c <<EOF
+fragment <<EOF
/* --- \begin{z80.em} */
/* Codes for machine types, bitwise or gives the code to use for the
output. */
@@ -36,7 +36,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
/* Bitwise or of the machine types seen so far. */
static int result_mach_type;
-static void
+static void
${LDEMUL_BEFORE_PARSE} (void)
{
#ifndef TARGET_ /* I.e., if not generic. */
@@ -53,19 +53,19 @@ ${LDEMUL_RECOGNIZED_FILE} (lang_input_statement_type *entry)
unsigned long mach_type;
mach_type = bfd_get_mach (entry->the_bfd);
- switch (mach_type)
+ switch (mach_type)
{
- case bfd_mach_z80strict:
- result_mach_type |= M_Z80STRICT;
+ case bfd_mach_z80strict:
+ result_mach_type |= M_Z80STRICT;
break;
case bfd_mach_z80:
- result_mach_type |= M_Z80;
+ result_mach_type |= M_Z80;
break;
case bfd_mach_z80full:
- result_mach_type |= M_Z80FULL;
+ result_mach_type |= M_Z80FULL;
break;
case bfd_mach_r800:
- result_mach_type |= M_R800;
+ result_mach_type |= M_R800;
break;
default:
result_mach_type |= M_Z80ANY;