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.
This commit is contained in:
Roland McGrath
2007-07-19 19:56:10 +00:00
parent 6b33789f61
commit 92b93329b5
43 changed files with 227 additions and 203 deletions

View File

@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ${EMULATION_NAME} /* AIX emulation code for ${EMULATION_NAME}
@ -1271,7 +1271,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f ${srcdir}/emultempl/ostring.sed" sc="-f ${srcdir}/emultempl/ostring.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -1292,7 +1292,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -1311,7 +1311,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_create_output_section_statements (void) gld${EMULATION_NAME}_create_output_section_statements (void)

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra alpha # This file is sourced from elf32.em, and defines extra alpha
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "elf/internal.h" #include "elf/internal.h"
#include "elf/alpha.h" #include "elf/alpha.h"

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME} /* 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. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -231,7 +231,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -250,7 +250,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -25,7 +25,7 @@
# specific routines. # specific routines.
# #
test -z "$TARGET2_TYPE" && TARGET2_TYPE="rel" test -z "$TARGET2_TYPE" && TARGET2_TYPE="rel"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "elf/arm.h" #include "elf/arm.h"

View File

@ -25,7 +25,7 @@
# of devices where one needs to address the issue that it is not possible # 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. # to reach the whole program memory by using 16 bit pointers.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "elf32-avr.h" #include "elf32-avr.h"
#include "ldctor.h" #include "ldctor.h"

View File

@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is part of GLD, the Gnu Linker. /* This file is part of GLD, the Gnu Linker.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc. 2005, 2006, 2007 Free Software Foundation, Inc.
@ -737,7 +737,7 @@ EOF
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -755,7 +755,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> 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 = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =

View File

@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra cr16-elf # This file is sourced from elf32.em, and defines extra cr16-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
@ -90,4 +90,3 @@ PARSE_AND_LIST_ARGS_CASES='
# #
LDEMUL_AFTER_PARSE=cr16elf_after_parse LDEMUL_AFTER_PARSE=cr16elf_after_parse
LDEMUL_BEFORE_ALLOCATION=cr16elf_before_allocation LDEMUL_BEFORE_ALLOCATION=cr16elf_before_allocation

View File

@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra crx-elf # This file is sourced from elf32.em, and defines extra crx-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
@ -92,4 +92,3 @@ PARSE_AND_LIST_ARGS_CASES='
# #
LDEMUL_AFTER_PARSE=crxelf_after_parse LDEMUL_AFTER_PARSE=crxelf_after_parse
LDEMUL_BEFORE_ALLOCATION=crxelf_before_allocation LDEMUL_BEFORE_ALLOCATION=crxelf_before_allocation

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em and from ELF targets that use # This file is sourced from elf32.em and from ELF targets that use
# generic.em. # generic.em.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout) gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)

View File

@ -8,7 +8,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME} /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
@ -70,7 +70,7 @@ EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case ${target} in case ${target} in
*-*-linux-* | *-*-k*bsd*-*) *-*-linux-* | *-*-k*bsd*-*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#ifdef HAVE_GLOB #ifdef HAVE_GLOB
#include <glob.h> #include <glob.h>
#endif #endif
@ -81,9 +81,9 @@ fi
# Import any needed special functions and/or overrides. # 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 if test -n "$EXTRA_EM_FILE" ; then
. ${srcdir}/emultempl/${EXTRA_EM_FILE}.em source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
fi fi
# Functions in this file can be overridden by setting the LDEMUL_* shell # 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. # as presumably it is called from the overriding function.
# #
if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_before_parse (void) gld${EMULATION_NAME}_before_parse (void)
@ -107,7 +107,7 @@ EOF
fi fi
if test x"$LDEMUL_RECOGNIZED_FILE" != xgld"${EMULATION_NAME}"_load_symbols; then 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. */ /* Handle as_needed DT_NEEDED. */
static bfd_boolean static bfd_boolean
@ -144,7 +144,7 @@ gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* These variables are required to pass information back and forth /* These variables are required to pass information back and forth
between after_open and check_needed and stat_needed and vercheck. */ 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 EOF
case ${target} in case ${target} in
*-*-linux-* | *-*-k*bsd*-*) *-*-linux-* | *-*-k*bsd*-*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
struct bfd_link_needed_list *l; struct bfd_link_needed_list *l;
@ -380,7 +380,7 @@ case ${target} in
EOF EOF
;; ;;
esac esac
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
} }
} }
@ -493,7 +493,7 @@ gld${EMULATION_NAME}_search_needed (const char *path,
EOF EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then 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 /* Add the sysroot to every entry in a path separated by
config.rpath_separator. */ config.rpath_separator. */
@ -536,7 +536,7 @@ gld${EMULATION_NAME}_add_sysroot (const char *path)
EOF EOF
case ${target} in case ${target} in
*-*-freebsd* | *-*-dragonfly*) *-*-freebsd* | *-*-dragonfly*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* Read the system search path the FreeBSD way rather than the Linux way. */ /* Read the system search path the FreeBSD way rather than the Linux way. */
#ifdef HAVE_ELF_HINTS_H #ifdef HAVE_ELF_HINTS_H
#include <elf-hints.h> #include <elf-hints.h>
@ -598,7 +598,7 @@ EOF
;; ;;
*-*-linux-* | *-*-k*bsd*-*) *-*-linux-* | *-*-k*bsd*-*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* For a native linker, check the file /etc/ld.so.conf for directories /* 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 in which we may find shared libraries. /etc/ld.so.conf is really
only meaningful on Linux. */ only meaningful on Linux. */
@ -808,7 +808,7 @@ EOF
;; ;;
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* See if an input file matches a DT_NEEDED entry by name. */ /* 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 EOF
if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static bfd_size_type static bfd_size_type
gld${EMULATION_NAME}_id_note_section_size (bfd *abfd, gld${EMULATION_NAME}_id_note_section_size (bfd *abfd,
@ -1188,31 +1188,31 @@ gld${EMULATION_NAME}_after_open (void)
search_dirs_type *search; search_dirs_type *search;
EOF EOF
if [ "x${NATIVE}" = xyes ] ; then if [ "x${NATIVE}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
const char *lib_path; const char *lib_path;
EOF EOF
fi fi
if [ "x${USE_LIBPATH}" = xyes ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct bfd_link_needed_list *rp; struct bfd_link_needed_list *rp;
int found; int found;
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link, if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
&n, force)) &n, force))
break; break;
EOF EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath, if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
&n, force)) &n, force))
break; break;
EOF EOF
fi fi
if [ "x${NATIVE}" = xyes ] ; then if [ "x${NATIVE}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (command_line.rpath_link == NULL if (command_line.rpath_link == NULL
&& command_line.rpath == NULL) && command_line.rpath == NULL)
{ {
@ -1227,7 +1227,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
fi fi
if [ "x${USE_LIBPATH}" = xyes ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
found = 0; found = 0;
rp = bfd_elf_get_runpath_list (output_bfd, &link_info); rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next) for (; !found && rp != NULL; rp = rp->next)
@ -1247,7 +1247,7 @@ fi
if [ "x${USE_LIBPATH}" = xyes ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case ${target} in case ${target} in
*-*-freebsd* | *-*-dragonfly*) *-*-freebsd* | *-*-dragonfly*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force)) if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
break; break;
EOF EOF
@ -1256,7 +1256,7 @@ EOF
*-*-linux-* | *-*-k*bsd*-*) *-*-linux-* | *-*-k*bsd*-*)
# Linux # Linux
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force)) if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
break; break;
@ -1264,7 +1264,7 @@ EOF
;; ;;
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
len = strlen (l->name); len = strlen (l->name);
for (search = search_head; search != NULL; search = search->next) for (search = search_head; search != NULL; search = search->next)
{ {
@ -1282,7 +1282,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
if (search != NULL) if (search != NULL)
break; break;
EOF EOF
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
} }
if (force < 2) if (force < 2)
@ -1296,7 +1296,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* Look through an expression for an assignment statement. */ /* Look through an expression for an assignment statement. */
@ -1377,7 +1377,7 @@ if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation;
else else
ELF_INTERPRETER_SET_DEFAULT= ELF_INTERPRETER_SET_DEFAULT=
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This is called after the sections have been attached to output /* This is called after the sections have been attached to output
sections, but before any sizes or addresses have been set. */ sections, but before any sizes or addresses have been set. */
@ -1478,7 +1478,7 @@ EOF
fi fi
if test x"$LDEMUL_OPEN_DYNAMIC_ARCHIVE" != xgld"$EMULATION_NAME"_open_dynamic_archive; then 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 /* 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 dynamic libraries have an extension of .so (or .sl on oddball systems
@ -1557,7 +1557,7 @@ EOF
fi fi
if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then 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. */ /* A variant of lang_output_section_find used by place_orphan. */
@ -1807,7 +1807,7 @@ EOF
fi fi
if test x"$LDEMUL_FINISH" != xgld"$EMULATION_NAME"_finish; then if test x"$LDEMUL_FINISH" != xgld"$EMULATION_NAME"_finish; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_finish (void) gld${EMULATION_NAME}_finish (void)
@ -1821,7 +1821,7 @@ EOF
fi fi
if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static char * static char *
gld${EMULATION_NAME}_get_script (int *isfile) gld${EMULATION_NAME}_get_script (int *isfile)
@ -1834,7 +1834,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -1888,7 +1888,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -1901,14 +1901,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then : if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then :
else else
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (!config.magic_demand_paged) else if (!config.magic_demand_paged)
return "ldscripts/${EMULATION_NAME}.xn"; return "ldscripts/${EMULATION_NAME}.xn";
EOF EOF
fi fi
if test -n "$GENERATE_PIE_SCRIPT" ; then if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_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 else if (link_info.pie && link_info.combreloc
&& link_info.relro && (link_info.flags & DT_BIND_NOW)) && link_info.relro && (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xdw"; return "ldscripts/${EMULATION_NAME}.xdw";
@ -1916,14 +1916,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xdc"; return "ldscripts/${EMULATION_NAME}.xdc";
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (link_info.pie) else if (link_info.pie)
return "ldscripts/${EMULATION_NAME}.xd"; return "ldscripts/${EMULATION_NAME}.xd";
EOF EOF
fi fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_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 else if (link_info.shared && link_info.combreloc
&& link_info.relro && (link_info.flags & DT_BIND_NOW)) && link_info.relro && (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xsw"; return "ldscripts/${EMULATION_NAME}.xsw";
@ -1931,13 +1931,13 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xsc"; return "ldscripts/${EMULATION_NAME}.xsc";
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (link_info.shared) else if (link_info.shared)
return "ldscripts/${EMULATION_NAME}.xs"; return "ldscripts/${EMULATION_NAME}.xs";
EOF EOF
fi fi
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (link_info.combreloc && link_info.relro else if (link_info.combreloc && link_info.relro
&& (link_info.flags & DT_BIND_NOW)) && (link_info.flags & DT_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xw"; return "ldscripts/${EMULATION_NAME}.xw";
@ -1945,7 +1945,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
return "ldscripts/${EMULATION_NAME}.xc"; return "ldscripts/${EMULATION_NAME}.xc";
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else else
return "ldscripts/${EMULATION_NAME}.x"; 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_ARGS_CASES" -o x"$GENERATE_SHLIB_SCRIPT" = xyes; then
if test -n "$PARSE_AND_LIST_PROLOGUE" ; then if test -n "$PARSE_AND_LIST_PROLOGUE" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
$PARSE_AND_LIST_PROLOGUE $PARSE_AND_LIST_PROLOGUE
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#define OPTION_DISABLE_NEW_DTAGS (400) #define OPTION_DISABLE_NEW_DTAGS (400)
#define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1) #define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1)
@ -1983,7 +1983,7 @@ gld${EMULATION_NAME}_add_options
EOF EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then 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}, {"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
{"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS}, {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
{"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR}, {"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR},
@ -1994,12 +1994,12 @@ EOF
fi fi
if test -n "$PARSE_AND_LIST_LONGOPTS" ; then if test -n "$PARSE_AND_LIST_LONGOPTS" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
$PARSE_AND_LIST_LONGOPTS $PARSE_AND_LIST_LONGOPTS
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{NULL, no_argument, NULL, 0} {NULL, no_argument, NULL, 0}
}; };
@ -2035,7 +2035,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
EOF EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
case OPTION_DISABLE_NEW_DTAGS: case OPTION_DISABLE_NEW_DTAGS:
link_info.new_dtags = FALSE; link_info.new_dtags = FALSE;
break; break;
@ -2128,7 +2128,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
if test -n "$COMMONPAGESIZE"; then if test -n "$COMMONPAGESIZE"; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (strcmp (optarg, "relro") == 0) else if (strcmp (optarg, "relro") == 0)
link_info.relro = TRUE; link_info.relro = TRUE;
else if (strcmp (optarg, "norelro") == 0) else if (strcmp (optarg, "norelro") == 0)
@ -2136,7 +2136,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
else if (CONST_STRNEQ (optarg, "max-page-size=")) else if (CONST_STRNEQ (optarg, "max-page-size="))
{ {
char *end; char *end;
@ -2166,12 +2166,12 @@ EOF
fi fi
if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
$PARSE_AND_LIST_ARGS_CASES $PARSE_AND_LIST_ARGS_CASES
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
} }
return TRUE; return TRUE;
@ -2180,7 +2180,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF EOF
if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_list_options (FILE * file) gld${EMULATION_NAME}_list_options (FILE * file)
@ -2189,7 +2189,7 @@ gld${EMULATION_NAME}_list_options (FILE * file)
EOF EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then 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, _(" -Bgroup\t\tSelects group name lookup rules for DSO\n"));
fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n")); fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n"));
fprintf (file, _(" --enable-new-dtags\tEnable 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 EOF
if test -n "$COMMONPAGESIZE"; then 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")); fprintf (file, _(" -z norelro\t\tDon't create RELRO program header\n"));
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n")); 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")); fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t at runtime\n"));
EOF EOF
if test -n "$COMMONPAGESIZE"; then if test -n "$COMMONPAGESIZE"; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
fprintf (file, _(" -z relro\t\tCreate RELRO program header\n")); fprintf (file, _(" -z relro\t\tCreate RELRO program header\n"));
EOF EOF
fi 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 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 common-page-size=SIZE\n\t\t\tSet common page size to SIZE\n"));
fprintf (file, _(" -z KEYWORD\t\tIgnored for Solaris compatibility\n")); fprintf (file, _(" -z KEYWORD\t\tIgnored for Solaris compatibility\n"));
@ -2237,34 +2237,34 @@ EOF
fi fi
if test -n "$PARSE_AND_LIST_OPTIONS" ; then if test -n "$PARSE_AND_LIST_OPTIONS" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS
EOF EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
} }
EOF EOF
if test -n "$PARSE_AND_LIST_EPILOGUE" ; then if test -n "$PARSE_AND_LIST_EPILOGUE" ; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
$PARSE_AND_LIST_EPILOGUE $PARSE_AND_LIST_EPILOGUE
EOF EOF
fi fi
fi fi
else else
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#define gld${EMULATION_NAME}_add_options NULL #define gld${EMULATION_NAME}_add_options NULL
#define gld${EMULATION_NAME}_handle_option NULL #define gld${EMULATION_NAME}_handle_option NULL
EOF EOF
if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then 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 #define gld${EMULATION_NAME}_list_options NULL
EOF EOF
fi fi
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -21,12 +21,12 @@
# This file is sourced from generic.em # This file is sourced from generic.em
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "elf-bfd.h" #include "elf-bfd.h"
EOF EOF
. ${srcdir}/emultempl/elf-generic.em source_em ${srcdir}/emultempl/elf-generic.em
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_finish (void) gld${EMULATION_NAME}_finish (void)

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME} /* emulate the original gld for the given ${EMULATION_NAME}
@ -45,11 +45,11 @@ EOF
# Import any needed special functions and/or overrides. # Import any needed special functions and/or overrides.
# #
if test -n "$EXTRA_EM_FILE" ; then if test -n "$EXTRA_EM_FILE" ; then
. ${srcdir}/emultempl/${EXTRA_EM_FILE}.em source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
fi fi
if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_before_parse (void) gld${EMULATION_NAME}_before_parse (void)
@ -63,7 +63,7 @@ EOF
fi fi
if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static char * static char *
gld${EMULATION_NAME}_get_script (int *isfile) gld${EMULATION_NAME}_get_script (int *isfile)
@ -76,7 +76,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -97,7 +97,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -116,7 +116,7 @@ EOF
fi fi
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007 /* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc. Free Software Foundation, Inc.
@ -80,7 +80,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -101,7 +101,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -120,7 +120,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_gld960_emulation = struct ld_emulation_xfer_struct ld_gld960_emulation =
{ {

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004, /* Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2007 Free Software Foundation, Inc. 2005, 2007 Free Software Foundation, Inc.
@ -94,7 +94,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -115,7 +115,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -134,7 +134,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_gld960coff_emulation = struct ld_emulation_xfer_struct ld_gld960coff_emulation =
{ {

View File

@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra hppa-elf # This file is sourced from elf32.em, and defines extra hppa-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
#include "elf32-hppa.h" #include "elf32-hppa.h"

View File

@ -25,7 +25,7 @@
# Define some shell vars to insert bits of code into the standard elf # Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions. # parse_args and list_options functions.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* None zero if generating binary for Intel Itanium processor. */ /* None zero if generating binary for Intel Itanium processor. */
static int itanium = 0; static int itanium = 0;
@ -60,4 +60,4 @@ PARSE_AND_LIST_ARGS_CASES='
' '
LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
. ${srcdir}/emultempl/needrelax.em source_em ${srcdir}/emultempl/needrelax.em

View File

@ -19,7 +19,7 @@
# MA 02110-1301, USA. # MA 02110-1301, USA.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ld.h" #include "ld.h"
#include "ldmain.h" #include "ldmain.h"
@ -40,4 +40,4 @@ irix_after_open (void)
EOF EOF
LDEMUL_AFTER_OPEN=irix_after_open LDEMUL_AFTER_OPEN=irix_after_open
. "${srcdir}/emultempl/mipself.em" source_em "${srcdir}/emultempl/mipself.em"

View File

@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* Linux a.out emulation code for ${EMULATION_NAME} /* Linux a.out emulation code for ${EMULATION_NAME}
@ -137,7 +137,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -158,7 +158,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -177,7 +177,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* intel coff loader emulation specific stuff /* intel coff loader emulation specific stuff
Copyright 1991, 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, Copyright 1991, 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
2005, 2007 Free Software Foundation, Inc. 2005, 2007 Free Software Foundation, Inc.
@ -217,7 +217,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -238,7 +238,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -257,7 +257,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_lnk960_emulation = struct ld_emulation_xfer_struct ld_lnk960_emulation =
{ {

View File

@ -40,7 +40,7 @@
# #
# Copied from hppaelf and adapted for M68HC11/M68HC12 specific needs. # Copied from hppaelf and adapted for M68HC11/M68HC12 specific needs.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
#include "elf32-m68hc1x.h" #include "elf32-m68hc1x.h"

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* Handle embedded relocs for m68k. /* Handle embedded relocs for m68k.
@ -171,7 +171,7 @@ then
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -192,7 +192,7 @@ echo '; }' >> e${EMULATION_NAME}.c
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -211,7 +211,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -31,7 +31,7 @@ case ${target} in
;; ;;
esac esac
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#ifdef SUPPORT_EMBEDDED_RELOCS #ifdef SUPPORT_EMBEDDED_RELOCS
static void check_sections (bfd *, asection *, void *); static void check_sections (bfd *, asection *, void *);

View File

@ -25,7 +25,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_before_parse (void) gld${EMULATION_NAME}_before_parse (void)
{ {

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA. # MA 02110-1301, USA.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
mips_after_parse (void) mips_after_parse (void)
{ {

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em and mmo.em, used to define # This file is sourced from elf32.em and mmo.em, used to define
# MMIX-specific things common to ELF and MMO. # MMIX-specific things common to ELF and MMO.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "elf/mmix.h" #include "elf/mmix.h"
/* Set up handling of linker-allocated global registers. */ /* Set up handling of linker-allocated global registers. */

View File

@ -22,9 +22,9 @@
# This file is sourced from elf32.em and used to define MMIX and ELF # 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. # 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 static void
elfmmix_before_parse (void) elfmmix_before_parse (void)

View File

@ -21,7 +21,7 @@
# This file is sourced from generic.em. # 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 /* Need to have this macro defined before mmix-elfnmmo, which uses the
name for the before_allocation function, defined in ldemul.c (for name for the before_allocation function, defined in ldemul.c (for
the mmo "emulation") or in elf32.em (for the elf64mmix the mmo "emulation") or in elf32.em (for the elf64mmix
@ -36,10 +36,10 @@ cat >>e${EMULATION_NAME}.c <<EOF
#include "elf-bfd.h" #include "elf-bfd.h"
EOF EOF
. ${srcdir}/emultempl/elf-generic.em source_em ${srcdir}/emultempl/elf-generic.em
. ${srcdir}/emultempl/mmix-elfnmmo.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 /* Place an orphan section. We use this to put random SEC_CODE or
SEC_READONLY sections right after MMO_TEXT_SECTION_NAME. Much borrowed SEC_READONLY sections right after MMO_TEXT_SECTION_NAME. Much borrowed

View File

@ -24,7 +24,7 @@
LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
need_relax_${EMULATION_NAME}_before_allocation (void) need_relax_${EMULATION_NAME}_before_allocation (void)

View File

@ -21,7 +21,7 @@
LDEMUL_BEFORE_PARSE=gldnetbsd_before_parse LDEMUL_BEFORE_PARSE=gldnetbsd_before_parse
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_before_parse (void); gld${EMULATION_NAME}_before_parse (void);

View File

@ -8,7 +8,7 @@ else
fi fi
rm -f e${EMULATION_NAME}.c rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) (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, /* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc. 2005, 2006, 2007 Free Software Foundation, Inc.
@ -1877,7 +1877,7 @@ EOF
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -1895,7 +1895,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> 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 = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =

View File

@ -8,7 +8,7 @@ else
fi fi
rm -f e${EMULATION_NAME}.c rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* Copyright 2006, 2007 Free Software Foundation, Inc. /* Copyright 2006, 2007 Free Software Foundation, Inc.
Written by Kai Tietz, OneVision Software GmbH&CoKg. Written by Kai Tietz, OneVision Software GmbH&CoKg.
@ -1656,7 +1656,7 @@ EOF
# sed commands to quote an ld script as a C string. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -1674,7 +1674,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> 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 = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra powerpc32-elf # This file is sourced from elf32.em, and defines extra powerpc32-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "libbfd.h" #include "libbfd.h"
#include "elf32-ppc.h" #include "elf32-ppc.h"
@ -126,7 +126,7 @@ ppc_before_allocation (void)
EOF EOF
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then 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. */ /* Special handling for embedded SPU executables. */
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *); extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *); static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra powerpc64-elf # This file is sourced from elf32.em, and defines extra powerpc64-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
#include "libbfd.h" #include "libbfd.h"
@ -466,7 +466,7 @@ ppc_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
EOF EOF
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then 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. */ /* Special handling for embedded SPU executables. */
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *); extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *); static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);

View File

@ -25,7 +25,7 @@
# This file is sourced from elf32.em, and defines extra score-elf # This file is sourced from elf32.em, and defines extra score-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static void static void
gld${EMULATION_NAME}_before_parse () 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. # Replace the elf before_parse function with our own.
LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse

View File

@ -26,7 +26,7 @@
LDEMUL_AFTER_ALLOCATION=sh64_elf_${EMULATION_NAME}_after_allocation LDEMUL_AFTER_ALLOCATION=sh64_elf_${EMULATION_NAME}_after_allocation
LDEMUL_BEFORE_ALLOCATION=sh64_elf_${EMULATION_NAME}_before_allocation LDEMUL_BEFORE_ALLOCATION=sh64_elf_${EMULATION_NAME}_before_allocation
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "libiberty.h" #include "libiberty.h"
#include "libbfd.h" #include "libbfd.h"

View File

@ -22,7 +22,7 @@
# This file is sourced from elf32.em, and defines extra spu specific # This file is sourced from elf32.em, and defines extra spu specific
# features. # features.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "ldctor.h" #include "ldctor.h"
#include "elf32-spu.h" #include "elf32-spu.h"
@ -50,7 +50,7 @@ EOF
../binutils/bin2c < ${srcdir}/emultempl/spu_ovl.o >> e${EMULATION_NAME}.c ../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 = { static const struct _ovl_stream ovl_mgr_stream = {
@ -247,7 +247,7 @@ gld${EMULATION_NAME}_finish (void)
EOF EOF
if grep -q 'ld_elf.*ppc.*_emulation' ldemul-list.h; then if grep -q 'ld_elf.*ppc.*_emulation' ldemul-list.h; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include "filenames.h" #include "filenames.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/wait.h> #include <sys/wait.h>

View File

@ -5,7 +5,7 @@ if [ -z "$MACHINE" ]; then
else else
OUTPUT_ARCH=${ARCH}:${MACHINE} OUTPUT_ARCH=${ARCH}:${MACHINE}
fi fi
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */ /* This file is is generated by a shell script. DO NOT EDIT! */
/* SunOS emulation code for ${EMULATION_NAME} /* SunOS emulation code for ${EMULATION_NAME}
@ -101,7 +101,7 @@ EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${host}" = "x${target}" ] ; then
case " ${EMULATION_LIBPATH} " in case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
const char *env; const char *env;
env = (const char *) getenv ("LD_LIBRARY_PATH"); env = (const char *) getenv ("LD_LIBRARY_PATH");
@ -128,7 +128,7 @@ EOF
;; ;;
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
} }
/* Despite the name, we use this routine to search for dynamic /* Despite the name, we use this routine to search for dynamic
@ -464,7 +464,7 @@ EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${host}" = "x${target}" ] ; then
case " ${EMULATION_LIBPATH} " in case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
const char *lib_path; const char *lib_path;
@ -476,7 +476,7 @@ EOF
;; ;;
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
if (command_line.rpath != NULL) if (command_line.rpath != NULL)
{ {
for (search = search_head; search != NULL; search = search->next) 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. # sed commands to quote an ld script as a C string.
sc="-f stringify.sed" sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
@ -982,7 +982,7 @@ echo '; }' >> e${EMULATION_NAME}
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -1001,7 +1001,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {

View File

@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
(echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) (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. /* This file is part of GLD, the Gnu Linker.
Copyright 1999, 2000, 2002, 2003, 2004, 2007 Copyright 1999, 2000, 2002, 2003, 2004, 2007
Free Software Foundation, Inc. Free Software Foundation, Inc.
@ -116,7 +116,7 @@ s/$/\\n\\/
1s/^/"/ 1s/^/"/
$s/$/n"/ $s/$/n"/
' '
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 0; *isfile = 0;
if (link_info.relocatable && config.build_constructors) if (link_info.relocatable && config.build_constructors)
@ -135,7 +135,7 @@ EOF
else else
# Scripts read from the filesystem. # Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
{ {
*isfile = 1; *isfile = 1;
@ -154,7 +154,7 @@ EOF
fi fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{ {
gld_${EMULATION_NAME}_before_parse, gld_${EMULATION_NAME}_before_parse,

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# It does some substitutions. # It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* A vanilla emulation with no defaults /* A vanilla emulation with no defaults
Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007 Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc. Free Software Foundation, Inc.

View File

@ -20,10 +20,10 @@
# #
if test -n "$VXWORKS_BASE_EM_FILE" ; then 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 fi
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
static int force_dynamic; 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`" var="LDEMUL_`echo ${override} | tr a-z A-Z`"
eval value=\$${var} eval value=\$${var}
if test "${value}" = "gld${EMULATION_NAME}_${override}"; then if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#define ${value} vxworks_${override} #define ${value} vxworks_${override}
EOF EOF
else else

View File

@ -23,7 +23,7 @@
# This file is sourced from elf32.em, and defines extra xtensa-elf # This file is sourced from elf32.em, and defines extra xtensa-elf
# specific routines. # specific routines.
# #
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
#include <xtensa-config.h> #include <xtensa-config.h>
#include "../bfd/elf-bfd.h" #include "../bfd/elf-bfd.h"
@ -2024,4 +2024,3 @@ LDEMUL_BEFORE_PARSE=elf_xtensa_before_parse
LDEMUL_AFTER_OPEN=elf_xtensa_after_open LDEMUL_AFTER_OPEN=elf_xtensa_after_open
LDEMUL_CHOOSE_TARGET=elf_xtensa_choose_target LDEMUL_CHOOSE_TARGET=elf_xtensa_choose_target
LDEMUL_BEFORE_ALLOCATION=elf_xtensa_before_allocation LDEMUL_BEFORE_ALLOCATION=elf_xtensa_before_allocation

View File

@ -23,7 +23,7 @@ LDEMUL_BEFORE_PARSE=gldz80_before_parse
LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file
LDEMUL_AFTER_OPEN=gldz80_after_open LDEMUL_AFTER_OPEN=gldz80_after_open
cat >>e${EMULATION_NAME}.c <<EOF fragment <<EOF
/* --- \begin{z80.em} */ /* --- \begin{z80.em} */
/* Codes for machine types, bitwise or gives the code to use for the /* Codes for machine types, bitwise or gives the code to use for the
output. */ output. */

View File

@ -393,5 +393,33 @@ case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) COMPILE_IN=true;; *" ${EMULATION_NAME} "*) COMPILE_IN=true;;
esac esac
if test -n "${BASH+set}"; then
source_em()
{
local current_script="$em_script"
em_script=$1
. $em_script
em_script=$current_script
}
fragment()
{
local lineno=$[${BASH_LINENO[0]} + 1]
echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
cat >> e${EMULATION_NAME}.c
}
else
source_em()
{
. $1
}
fragment()
{
cat >> e${EMULATION_NAME}.c
}
fi
# Generate e${EMULATION_NAME}.c. # Generate e${EMULATION_NAME}.c.
. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em # Start with an empty file, then the sourced .em script
# can use the "fragment" function to append.
> e${EMULATION_NAME}.c
source_em ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em