aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-08-06 22:46:03 +0000
committerIan Lance Taylor <ian@airs.com>1999-08-06 22:46:03 +0000
commit597e25914ec5895fba8097946514d4b8c878eb0a (patch)
treefdc7d79e1329f02cd7685d15e9dc98a2d5072989 /ld
parent4a607dcc2c50b3c622c4e12c405ef33d85ee7f5f (diff)
downloadgdb-597e25914ec5895fba8097946514d4b8c878eb0a.zip
gdb-597e25914ec5895fba8097946514d4b8c878eb0a.tar.gz
gdb-597e25914ec5895fba8097946514d4b8c878eb0a.tar.bz2
* emultempl/ostring.sed: Rename from stringify.sed.
* emultempl/astring.sed: New file. * Makefile.am (stringify.sed): New target. (GEN_DEPENDS): Change $(srcdir)/emultempl/stringify.sed to stringify.sed. * configure.in: Define and substitute STRINGIFY. * emultempl/*.em: Use stringify.sed from build directory rather than source directory. * emultempl/elf32.em: Use stringify.sed rather than inline sed script. * emultempl/gld960.em, emultempl/gld960c.em: Likewise. * emultempl/hppaelf.em, emultempl/linux.em: Likewise. * emultempl/lnk960.em, emultempl/sunos.em: Likewise. * configure, Makefile.in: Rebuild.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog17
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in6
-rwxr-xr-xld/configure37
-rw-r--r--ld/configure.in17
-rw-r--r--ld/emultempl/aix.em4
-rw-r--r--ld/emultempl/armcoff.em4
-rw-r--r--ld/emultempl/armelf.em2
-rw-r--r--ld/emultempl/armelf_oabi.em2
-rw-r--r--ld/emultempl/astring.sed13
-rw-r--r--ld/emultempl/beos.em4
-rw-r--r--ld/emultempl/elf32.em35
-rw-r--r--ld/emultempl/generic.em4
-rw-r--r--ld/emultempl/gld960.em29
-rw-r--r--ld/emultempl/gld960c.em29
-rw-r--r--ld/emultempl/hppaelf.em29
-rw-r--r--ld/emultempl/linux.em29
-rw-r--r--ld/emultempl/lnk960.em30
-rw-r--r--ld/emultempl/mipsecoff.em4
-rw-r--r--ld/emultempl/ostring.sed (renamed from ld/emultempl/stringify.sed)0
-rw-r--r--ld/emultempl/pe.em2
-rw-r--r--ld/emultempl/sunos.em27
22 files changed, 198 insertions, 131 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2f0154f..e9c7c5d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,20 @@
+1999-08-06 Ian Lance Taylor <ian@zembu.com>
+
+ * emultempl/ostring.sed: Rename from stringify.sed.
+ * emultempl/astring.sed: New file.
+ * Makefile.am (stringify.sed): New target.
+ (GEN_DEPENDS): Change $(srcdir)/emultempl/stringify.sed to
+ stringify.sed.
+ * configure.in: Define and substitute STRINGIFY.
+ * emultempl/*.em: Use stringify.sed from build directory rather
+ than source directory.
+ * emultempl/elf32.em: Use stringify.sed rather than inline sed
+ script.
+ * emultempl/gld960.em, emultempl/gld960c.em: Likewise.
+ * emultempl/hppaelf.em, emultempl/linux.em: Likewise.
+ * emultempl/lnk960.em, emultempl/sunos.em: Likewise.
+ * configure, Makefile.in: Rebuild.
+
1999-08-05 Donn Terry <donn@interix.com>
* emulparams/i386pe.sh: Define ENTRY, SUBSYSTEM, and
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 3e7f23b..1934092 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -260,10 +260,13 @@ ldemul-list.h: Makefile
echo " 0") >ldemul-tmp.h
mv ldemul-tmp.h ldemul-list.h
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+ cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
+
# These all start with e so 'make clean' can find them.
GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
-GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
+GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
@TDIRS@
ea29k.c: $(srcdir)/emulparams/a29k.sh \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index b59641f..7506e45 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -95,6 +95,7 @@ PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
+STRINGIFY = @STRINGIFY@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
@@ -351,7 +352,7 @@ POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
# These all start with e so 'make clean' can find them.
GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
-GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
+GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
ld_new_SOURCES = ldgram.y ldlex.l lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c
@@ -964,6 +965,9 @@ ldemul-list.h: Makefile
done;\
echo " 0") >ldemul-tmp.h
mv ldemul-tmp.h ldemul-list.h
+
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+ cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
@TDIRS@
ea29k.c: $(srcdir)/emulparams/a29k.sh \
diff --git a/ld/configure b/ld/configure
index 00a8d9d..f2baf1d 100755
--- a/ld/configure
+++ b/ld/configure
@@ -4717,6 +4717,42 @@ EOF
fi
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise. This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+if eval "test \"`echo '$''{'ld_cv_string_concatenation'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4731 "configure"
+#include "confdefs.h"
+
+int main() {
+char *a = "a" "a";
+; return 0; }
+EOF
+if { (eval echo configure:4738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ld_cv_string_concatenation=true
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ld_cv_string_concatenation=false
+fi
+rm -f conftest*
+fi
+
+if test "$ld_cv_string_concatenation" = "true"; then
+ STRINGIFY=astring.sed
+else
+ STRINGIFY=ostring.sed
+fi
+
+
# target-specific stuff:
all_targets=
@@ -5013,6 +5049,7 @@ s%@HDEFINES@%$HDEFINES%g
s%@HOSTING_CRT0@%$HOSTING_CRT0%g
s%@HOSTING_LIBS@%$HOSTING_LIBS%g
s%@NATIVE_LIB_DIRS@%$NATIVE_LIB_DIRS%g
+s%@STRINGIFY@%$STRINGIFY%g
s%@EMUL@%$EMUL%g
/@TDIRS@/r $TDIRS
s%@TDIRS@%%g
diff --git a/ld/configure.in b/ld/configure.in
index 01b802e..a3546c7 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -68,6 +68,23 @@ BFD_NEED_DECLARATION(sbrk)
BFD_NEED_DECLARATION(getenv)
BFD_NEED_DECLARATION(environ)
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise. This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+AC_CACHE_VAL(ld_cv_string_concatenation,
+[AC_TRY_COMPILE(,[char *a = "a" "a";],
+ [ld_cv_string_concatenation=true],
+ [ld_cv_string_concatenation=false])])
+if test "$ld_cv_string_concatenation" = "true"; then
+ STRINGIFY=astring.sed
+else
+ STRINGIFY=ostring.sed
+fi
+AC_SUBST(STRINGIFY)
+
# target-specific stuff:
all_targets=
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index c77857f..6748af0 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ${EMULATION_NAME}
- Copyright (C) 1991, 93, 95, 96, 97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
@@ -985,7 +985,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 484ff83..3caaa80 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright (C) 1991, 93, 96, 97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -220,7 +220,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index a0f1a0d..583850d 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -1211,7 +1211,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/armelf_oabi.em b/ld/emultempl/armelf_oabi.em
index 20a50df..3a2dfe4 100644
--- a/ld/emultempl/armelf_oabi.em
+++ b/ld/emultempl/armelf_oabi.em
@@ -105,7 +105,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/astring.sed b/ld/emultempl/astring.sed
new file mode 100644
index 0000000..08bd8a6
--- /dev/null
+++ b/ld/emultempl/astring.sed
@@ -0,0 +1,13 @@
+s/["\\]/\\&/g
+s/$/\\n\\/
+1 s/^/"/
+25s/\\$/"/
+26s/^/"/
+50s/\\$/"/
+51s/^/"/
+75s/\\$/"/
+76s/^/"/
+100s/\\$/"/
+101s/^/"/
+$ s/$/n"/
+$ s/\\n"n"$/\\n"/
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index c2b3ec2..39490ca 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -2,7 +2,7 @@
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
/* This file is part of GLD, the Gnu Linker.
- Copyright 1995, 96, 97, 1998 Free Software Foundation, Inc.
+ Copyright 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -790,7 +790,7 @@ gld_${EMULATION_NAME}_get_script(isfile)
EOF
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 4ec259c..163e4c9 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1069,38 +1069,31 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
-cat >>e${EMULATION_NAME}.c <<EOF
- else if (link_info.shared)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xs`;
-EOF
+echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
fi
-cat >>e${EMULATION_NAME}.c <<EOF
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
-EOF
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index 1c0c8eb..9a3f530 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -56,7 +56,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index df998fb..63b4af0 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 1999 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -111,28 +111,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index 20cb5ed..4789b22 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
-/* Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -127,28 +127,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index c0ca113..69abe3b 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -2,7 +2,7 @@
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
/* An emulation for HP PA-RISC ELF linkers.
- Copyright (C) 1991, 93, 94, 95, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -216,28 +216,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index 29f5bd1..b8a03ff 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Linux a.out emulation code for ${EMULATION_NAME}
- Copyright (C) 1991, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
Linux support by Eric Youngdale <ericy@cais.cais.com>
@@ -140,28 +140,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index 066d46b..9df2f60 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -2,7 +2,7 @@
# It does some substitutions.
cat >e${EMULATION_NAME}.c <<EOF
/* intel coff loader emulation specific stuff
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -263,27 +263,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
+{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em
index d1200c4..10d5924 100644
--- a/ld/emultempl/mipsecoff.em
+++ b/ld/emultempl/mipsecoff.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Handle embedded relocs for MIPS.
- Copyright 1994 Free Software Foundation, Inc.
+ Copyright 1994, 95, 97, 1999 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em.
This file is part of GLD, the Gnu Linker.
@@ -167,7 +167,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/stringify.sed b/ld/emultempl/ostring.sed
index a526d3f..a526d3f 100644
--- a/ld/emultempl/stringify.sed
+++ b/ld/emultempl/ostring.sed
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index bdab4f9..936f4e8 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1196,7 +1196,7 @@ gld_${EMULATION_NAME}_get_script(isfile)
EOF
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 61a5c01..8f095fe 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -971,28 +971,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
+echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
+echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
+echo ' ; else return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
+echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.