From de566389ca05df16872de9b85ca473157d36703d Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Sat, 15 Feb 1992 22:13:53 +0000 Subject: [PATCH] Major rewrite of how ld is configured. The major idea is to use shell scripts to generate everything. * Each emulation is defined by a short shell script with extension *.sh that specifies the emulation-specific parameters (such as the name of the *.sh-sc and *.em files to use). * genscript.sh is the master shell script used to generate an emulation. It is passed various argument, including the name a the emulation-speciic *.sh file that it "sources" to set variables to emulation-specifc parameters. --- ld/a29k.sh | 6 +++++ ld/ebmon29k.sh | 6 +++++ ld/genscripts.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ ld/gld960.sh | 8 +++++++ ld/h8300hms.sh | 7 ++++++ ld/i386aout.sh | 7 ++++++ ld/lnk960.sh | 7 ++++++ ld/m88kbcs.sh | 6 +++++ ld/news.sh | 6 +++++ ld/sun3.sh | 8 +++++++ ld/sun4.sh | 7 ++++++ ld/vanilla.sh | 6 +++++ 12 files changed, 135 insertions(+) create mode 100755 ld/a29k.sh create mode 100755 ld/ebmon29k.sh create mode 100755 ld/genscripts.sh create mode 100755 ld/gld960.sh create mode 100755 ld/h8300hms.sh create mode 100755 ld/i386aout.sh create mode 100755 ld/lnk960.sh create mode 100755 ld/m88kbcs.sh create mode 100755 ld/news.sh create mode 100755 ld/sun3.sh create mode 100755 ld/sun4.sh create mode 100755 ld/vanilla.sh diff --git a/ld/a29k.sh b/ld/a29k.sh new file mode 100755 index 0000000000..f1b7dea300 --- /dev/null +++ b/ld/a29k.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=a29k +SCRIPT_NAME=a29k +OUTPUT_FORMAT="coff-a29k-big" +TEXT_START_ADDR=0x1000000 +PAGE_SIZE=0x1000000 +ARCH=a29k diff --git a/ld/ebmon29k.sh b/ld/ebmon29k.sh new file mode 100755 index 0000000000..a7c36348e3 --- /dev/null +++ b/ld/ebmon29k.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=ebmon29k +SCRIPT_NAME=ebmon29k +OUTPUT_FORMAT="coff-a29k-big" +TEXT_START_ADDR=0x8000 +PAGE_SIZE=0x1000 +ARCH=a29k diff --git a/ld/genscripts.sh b/ld/genscripts.sh new file mode 100755 index 0000000000..7882a418bf --- /dev/null +++ b/ld/genscripts.sh @@ -0,0 +1,61 @@ +# This shell script does the work of generating the ld-emulation-target +# specific information from a specific file of paramaters. +# Usage: genscripts.sh srcdir host_alias target_alias emulation_name + +srcdir=$1 +host_alias=$2 +target_alias=$3 + +# Include the emulation-specic parameters: +. ${srcdir}/$4 + +# Set the library search path (for libraries named by -lfoo). +# If LIB_PATH is defined (and non-empty), it is used. +# (The format is the usual list of colon-separated directories.) +# (To force a logically empty LIB_PATH, do LIBPATH=":".) +# Otherwise, the default is /lib:/usr/lib:/usr/local/lib, +# unless cross-compiling, in which case the default remains empty. + +if [ "x${LIB_PATH}" = "x" -a "x${host_alias}" = "x${target_alias}" ] ; then + LIB_PATH=/lib:/usr/lib:/usr/local/lib +fi +LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'` + +# This script generates 5 script files from the master script template +# in ${srcdir}/${SCRIPT_NAME}.sh. Which one of the 5 script files +# is actually used depends on command line flags given to ld. +# The actual script is filtered through the mkscript program +# to convert it to a form suitable for including in a C program +# as a C string literal. +# +# A .x script file is the default script. +# A .xr script is for linking without relocation (-r flag). +# A .xu script is like .xr, but *do* create constructors (-Ur flag). +# A .xn script is for linking with -n flag (mix text and data on same page). +# A .xN script is for linking with -N flag (mix text and data on same page). + +THIS_TEXT_START_ADDR=${TEXT_START_ADDR} +SEGMENT_SIZE=${SEGMENT_SIZE-${PAGE_SIZE}} + +DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})" +FILTER_SCRIPT="" +(. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \ + >${EMULATION_NAME}.xr +CONSTRUCTING= +(. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \ + >${EMULATION_NAME}.xu +RELOCATING= +(. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \ + >${EMULATION_NAME}.x +THIS_TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}} +(. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \ + >${EMULATION_NAME}.xn +DATA_ALIGNMENT="." +(. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \ + >${EMULATION_NAME}.xN + +#sed -e s/""/${EMULATION_NAME}/g -e s/""/${ARCH}/g \ +# -e s/""/${EMULATION_NAME}/g -e s/""/${OUTPUT_FORMAT}/g \ +# <${srcdir}/${TEMPLATE_NAME-ldtemplate} >ld__${EMULATION_NAME}.c + +. ${srcdir}/${TEMPLATE_NAME-generic}.em diff --git a/ld/gld960.sh b/ld/gld960.sh new file mode 100755 index 0000000000..d4fea7aee2 --- /dev/null +++ b/ld/gld960.sh @@ -0,0 +1,8 @@ +EMULATION_NAME=gld960 +SCRIPT_NAME=i960 +OUTPUT_FORMAT="" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=i960 +TEMPLATE_NAME=gld960 +GLD_STYLE=1 diff --git a/ld/h8300hms.sh b/ld/h8300hms.sh new file mode 100755 index 0000000000..67af09b7a7 --- /dev/null +++ b/ld/h8300hms.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=h8300hms +SCRIPT_NAME=h8300hms +OUTPUT_FORMAT="coff-h8300" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=h8300 +TEMPLATE_NAME=h8300hms diff --git a/ld/i386aout.sh b/ld/i386aout.sh new file mode 100755 index 0000000000..fa7d265942 --- /dev/null +++ b/ld/i386aout.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=i386aout +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-i386" +PAGE_SIZE=0x1000 +TEXT_START_ADDR=0 +NONPAGED_TEXT_START_ADDR=0x1000 +ARCH=i386 diff --git a/ld/lnk960.sh b/ld/lnk960.sh new file mode 100755 index 0000000000..9dff06285d --- /dev/null +++ b/ld/lnk960.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=lnk960 +SCRIPT_NAME=i960 +OUTPUT_FORMAT="" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=i960 +TEMPLATE_NAME=lnk960 diff --git a/ld/m88kbcs.sh b/ld/m88kbcs.sh new file mode 100755 index 0000000000..690d9e9602 --- /dev/null +++ b/ld/m88kbcs.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=m88kbcs +SCRIPT_NAME=m88kbcs +OUTPUT_FORMAT="m88kbcs" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=m88k diff --git a/ld/news.sh b/ld/news.sh new file mode 100755 index 0000000000..a91854448d --- /dev/null +++ b/ld/news.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=news +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-newsos3" +TEXT_START_ADDR=0 +PAGE_SIZE=0x1000 +ARCH=m68k diff --git a/ld/sun3.sh b/ld/sun3.sh new file mode 100755 index 0000000000..b47e0dc00f --- /dev/null +++ b/ld/sun3.sh @@ -0,0 +1,8 @@ +EMULATION_NAME=sun3 +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-sunos-big" +TEXT_START_ADDR=0x2020 +PAGE_SIZE=0x2000 +SEGMENT_SIZE=0x20000 +NONPAGED_TEXT_START_ADDR=0x2000 +ARCH=m68k diff --git a/ld/sun4.sh b/ld/sun4.sh new file mode 100755 index 0000000000..d126fed0d1 --- /dev/null +++ b/ld/sun4.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=sun4 +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-sunos-big" +TEXT_START_ADDR=0x2020 +PAGE_SIZE=0x2000 +NONPAGED_TEXT_START_ADDR=0x2000 +ARCH=sparc diff --git a/ld/vanilla.sh b/ld/vanilla.sh new file mode 100755 index 0000000000..7762581741 --- /dev/null +++ b/ld/vanilla.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=vanilla +SCRIPT_NAME=vanilla +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=unknown +TEMPLATE_NAME=vanilla