From 597e25914ec5895fba8097946514d4b8c878eb0a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Aug 1999 22:46:03 +0000 Subject: [PATCH] * 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. --- ld/ChangeLog | 17 ++++++++++ ld/Makefile.am | 5 ++- ld/Makefile.in | 6 +++- ld/configure | 37 +++++++++++++++++++++ ld/configure.in | 17 ++++++++++ ld/emultempl/aix.em | 4 +-- ld/emultempl/armcoff.em | 4 +-- ld/emultempl/armelf.em | 2 +- ld/emultempl/armelf_oabi.em | 2 +- ld/emultempl/astring.sed | 13 ++++++++ ld/emultempl/beos.em | 4 +-- ld/emultempl/elf32.em | 35 ++++++++----------- ld/emultempl/generic.em | 4 +-- ld/emultempl/gld960.em | 29 ++++++++-------- ld/emultempl/gld960c.em | 29 ++++++++-------- ld/emultempl/hppaelf.em | 29 ++++++++-------- ld/emultempl/linux.em | 29 ++++++++-------- ld/emultempl/lnk960.em | 30 ++++++++--------- ld/emultempl/mipsecoff.em | 4 +-- ld/emultempl/{stringify.sed => ostring.sed} | 0 ld/emultempl/pe.em | 2 +- ld/emultempl/sunos.em | 27 +++++++-------- 22 files changed, 198 insertions(+), 131 deletions(-) create mode 100644 ld/emultempl/astring.sed rename ld/emultempl/{stringify.sed => ostring.sed} (100%) diff --git a/ld/ChangeLog b/ld/ChangeLog index 2f0154f09c..e9c7c5d9db 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,20 @@ +1999-08-06 Ian Lance Taylor + + * 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 * emulparams/i386pe.sh: Define ENTRY, SUBSYSTEM, and diff --git a/ld/Makefile.am b/ld/Makefile.am index 3e7f23b58e..193409229b 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 b59641fdd7..7506e456f3 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 00a8d9d6c6..f2baf1db60 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 <&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 01b802eeae..a3546c7671 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 c77857f822..6748af0b38 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c < AIX support by Ian Lance Taylor @@ -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 <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> 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 <> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c fi -cat >>e${EMULATION_NAME}.c <> 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 1c0c8eb214..9a3f530782 100644 --- a/ld/emultempl/generic.em +++ b/ld/emultempl/generic.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> 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 20cb5eda4e..4789b22e5b 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 <>e${EMULATION_NAME}.c <> 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 c0ca113db4..69abe3ba2e 100644 --- a/ld/emultempl/hppaelf.em +++ b/ld/emultempl/hppaelf.em @@ -2,7 +2,7 @@ # It does some substitutions. cat >e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> 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 29f5bd1b55..b8a03ff607 100644 --- a/ld/emultempl/linux.em +++ b/ld/emultempl/linux.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c < Linux support by Eric Youngdale @@ -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 <> 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 066d46bb32..9df2f609af 100644 --- a/ld/emultempl/lnk960.em +++ b/ld/emultempl/lnk960.em @@ -2,7 +2,7 @@ # It does some substitutions. cat >e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> 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 d1200c46d7..10d5924691 100644 --- a/ld/emultempl/mipsecoff.em +++ b/ld/emultempl/mipsecoff.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c < 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 <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> 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. -- 2.34.1