Now that there are no remaining users of ld.bfd, remove the ld subdir.

This commit is contained in:
Brandon Bergren 2020-03-27 01:12:11 +00:00
parent 12d3a32659
commit ded22b4527
21 changed files with 0 additions and 2878 deletions

View File

@ -1,89 +0,0 @@
# $FreeBSD$
ELF_SCR_EXT= x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
.include "../Makefile.inc0"
.include <src.opts.mk>
.PATH: ${SRCDIR}/ld
PROG= ld.bfd
.if (!defined(TOOLS_PREFIX) && ${MK_LLD_IS_LD} == "no") || \
(defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} == "no")
MAN= ld.1
LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
.else
MAN= ld.bfd.1
CLEANFILES+= ld.bfd.1
ld.bfd.1: ld.1
${CP} ${.ALLSRC} ${.TARGET}
.endif
SCRIPTDIR= /usr/libdata/ldscripts
SRCS+= ldcref.c \
ldctor.c \
ldemul-list.h \
ldemul.c \
ldexp.c \
ldfile.c \
ldgram.y \
ldlang.c \
ldlex.l \
ldmain.c \
ldmisc.c \
ldver.c \
ldwrite.c \
lexsup.c \
mri.c
CFLAGS+= -DTARGET=\"${TARGET_TUPLE}\"
CFLAGS+= -DDEFAULT_EMULATION=\"${NATIVE_EMULATION}\"
CFLAGS+= -DSCRIPTDIR=\"${TOOLS_PREFIX}/usr/libdata\"
CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\"
CFLAGS+= -DBINDIR=\"${BINDIR}\"
.if defined(TOOLS_PREFIX)
CFLAGS+= -DTARGET_SYSTEM_ROOT=\"${TOOLS_PREFIX}\"
.else
CFLAGS+= -DTARGET_SYSTEM_ROOT=\"/\"
.endif
CFLAGS+= -DTOOLBINDIR=\"${TOOLS_PREFIX}/${BINDIR}/libexec\"
CFLAGS+= -D_GNU_SOURCE
CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd
.if ${MK_SHARED_TOOLCHAIN} == "no"
NO_SHARED?= yes
.endif
DPADD= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a
DPADD+= ${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a
LDADD= ${DPADD}
CLEANDIRS+= ldscripts
CLEANFILES+= ldemul-list.h stringify.sed
FILES= ${LDSCRIPTS:S|^|ldscripts/|}
FILESDIR= ${SCRIPTDIR}
HOST= ${TARGET_TUPLE}
LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\"
.for ext in ${ELF_SCR_EXT}
.if !empty(LDSCRIPTS) && ${LDSCRIPTS:M${NATIVE_EMULATION}.${ext}} != ""
.error "NATIVE_EMULATION scripts were added to LDSCRIPTS: ${LDSCRIPTS:M${NATIVE_EMULATION}.${ext}}"
.endif
LDSCRIPTS+= ${NATIVE_EMULATION}.${ext}
ldscripts/${NATIVE_EMULATION}.${ext}: e${NATIVE_EMULATION}.c
.endfor
EMXFR=
EMLST=
.for _e in ${NATIVE_EMULATION} ${EMS}
EMXFR+= extern ld_emulation_xfer_type ld_${_e}_emulation;
EMLST+= &ld_${_e}_emulation,
.endfor
ldemul-list.h:
echo "${EMXFR}" > ${.TARGET}
echo "#define EMULATION_LIST ${EMLST} 0" >> ${.TARGET}
stringify.sed: ${SRCDIR}/ld/emultempl/astring.sed .NOMETA
ln -sf ${.ALLSRC} ${.TARGET}
GENDIRDEPS_FILTER.host+= Nusr.bin/yacc
.include <bsd.prog.mk>

View File

@ -1,29 +0,0 @@
# $FreeBSD$
NATIVE_EMULATION= elf_x86_64_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
X86_EMULATION= elf_i386_fbsd
_i386_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${X86_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${X86_EMULATION}.${ext}
ldscripts/${X86_EMULATION}.${ext}: e${X86_EMULATION}.c
.endfor
SRCS+= e${X86_EMULATION}.c
CLEANFILES+= e${X86_EMULATION}.c
e${X86_EMULATION}.c: emulparams/${X86_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${_i386_path} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${X86_EMULATION} "" no ${X86_EMULATION} ${TARGET_TUPLE}

View File

@ -1,17 +0,0 @@
# $FreeBSD$
.if ${TARGET_ARCH:Marm*eb} != ""
NATIVE_EMULATION= armelfb_fbsd
.else
NATIVE_EMULATION= armelf_fbsd
.endif
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: ${.CURDIR}/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE} \
${.CURDIR}/${NATIVE_EMULATION}.sh

View File

@ -1,20 +0,0 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/usr.bin/binutils/libbfd \
gnu/usr.bin/binutils/libiberty \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
usr.bin/yacc.host \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -1,14 +0,0 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/usr.bin/binutils/libbfd \
gnu/usr.bin/binutils/libiberty \
usr.bin/yacc \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -1,12 +0,0 @@
# $FreeBSD$
NATIVE_EMULATION= elf_i386_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}

View File

@ -1,38 +0,0 @@
# $FreeBSD$
.if ${TARGET_ARCH:Mmips*el*} != ""
_EMULATION_ENDIAN=l
.else
_EMULATION_ENDIAN=b
.endif
.if ${TARGET_ARCH:Mmips64*} != ""
NATIVE_EMULATION=elf64${_EMULATION_ENDIAN}tsmip_fbsd
LIBSEARCHPATH.elf32${_EMULATION_ENDIAN}tsmip_fbsd=\"=/usr/lib32\"
.elif ${TARGET_ARCH:Mmipsn32*} != ""
NATIVE_EMULATION=elf32${_EMULATION_ENDIAN}tsmipn32_fbsd
.else
NATIVE_EMULATION?=elf32${_EMULATION_ENDIAN}tsmip_fbsd
.endif
MIPS_ABIS=elf32btsmip_fbsd elf32ltsmip_fbsd elf64btsmip_fbsd elf64ltsmip_fbsd \
elf32btsmipn32_fbsd elf32ltsmipn32_fbsd
.for abi in ${MIPS_ABIS}
EMS+= ${abi}
.if ${abi} != ${NATIVE_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${abi}.${ext}
ldscripts/${abi}.${ext}: e${abi}.c
.endfor
.endif
SRCS+= e${abi}.c
CLEANFILES+= e${abi}.c
# nb: elf32 handles both elf32 and elf64 targets
e${abi}.c: ${.CURDIR}/${abi}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${abi} "" no ${abi} ${TARGET_TUPLE} \
${.CURDIR}/${abi}.sh
.endfor

View File

@ -1,12 +0,0 @@
# $FreeBSD$
NATIVE_EMULATION= elf32ppc_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed ldemul-list.h
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}

View File

@ -1,30 +0,0 @@
# $FreeBSD$
NATIVE_EMULATION= elf64ppc_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed ldemul-list.h
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
PPC32_EMULATION= elf32ppc_fbsd
_ppc32_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${PPC32_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${PPC32_EMULATION}.${ext}
ldscripts/${PPC32_EMULATION}.${ext}: e${PPC32_EMULATION}.c
.endfor
SRCS+= e${PPC32_EMULATION}.c
CLEANFILES+= e${PPC32_EMULATION}.c
e${PPC32_EMULATION}.c: emulparams/${PPC32_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed ldemul-list.h
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${_ppc32_path} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${PPC32_EMULATION} "" no ${PPC32_EMULATION} ${TARGET_TUPLE}

View File

@ -1,32 +0,0 @@
# $FreeBSD$
NATIVE_EMULATION= elf64_sparc_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
.for BITS in 64 32
EMS+= elf${BITS}_sparc
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= elf${BITS}_sparc.${ext}
ldscripts/elf${BITS}_sparc.${ext}: eelf${BITS}_sparc.c
.endfor
SRCS+= eelf${BITS}_sparc.c
CLEANFILES+= eelf${BITS}_sparc.c
eelf${BITS}_sparc.c: emulparams/elf${BITS}_sparc.sh emultempl/elf32.em \
scripttempl/elf.sc genscripts.sh stringify.sed
sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSEARCHPATH} \
${TOOLS_PREFIX}/usr \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
elf${BITS}_sparc "" no elf${BITS}_sparc ${TARGET_TUPLE}
.endfor # BITS

View File

@ -1,9 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/armelf.sh
. ${srcdir}/emulparams/elf_fbsd.sh
TARGET2_TYPE=got-rel
MAXPAGESIZE=0x8000
GENERATE_PIE_SCRIPT=yes
unset STACK_ADDR
unset EMBEDDED

View File

@ -1,14 +0,0 @@
# $FreeBSD$
#XXX: This should be used once those bits are merged back in the FSF repo.
#. ${srcdir}/emulparams/armelf_fbsd.sh
#
#OUTPUT_FORMAT="elf32-bigarm"
. ${srcdir}/emulparams/armelf.sh
. ${srcdir}/emulparams/elf_fbsd.sh
TARGET2_TYPE=got-rel
MAXPAGESIZE=0x8000
GENERATE_PIE_SCRIPT=yes
unset STACK_ADDR
unset EMBEDDED
OUTPUT_FORMAT="elf32-bigarm"

View File

@ -1,141 +0,0 @@
/* $FreeBSD$ */
/* config.h. Generated by configure. */
/* config.in. Generated from configure.in by autoheader. */
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
/* Additional extension a shared object might have. */
/* #undef EXTRA_SHLIB_EXTENSION */
/* Define to 1 if you have the declaration of `environ', and to 0 if you
don't. */
#define HAVE_DECL_ENVIRON 0
/* Define to 1 if you have the declaration of `free', and to 0 if you don't.
*/
#define HAVE_DECL_FREE 1
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#define HAVE_DECL_GETENV 1
/* Is the prototype for getopt in <unistd.h> in the expected format? */
#define HAVE_DECL_GETOPT 1
/* Define to 1 if you have the declaration of `sbrk', and to 0 if you don't.
*/
#define HAVE_DECL_SBRK 1
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
*/
#define HAVE_DECL_STRSTR 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <elf-hints.h> header file. */
#define HAVE_ELF_HINTS_H 1
/* Define to 1 if you have the `glob' function. */
#define HAVE_GLOB 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `sbrk' function. */
/* #undef HAVE_SBRK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `waitpid' function. */
#define HAVE_WAITPID 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "ld"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* The size of a `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Use b modifier when opening binary files? */
/* #undef USE_BINARY_FOPEN */
/* Version number of package */
/* #define VERSION "2.17.50" */
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#define YYTEXT_POINTER 1

View File

@ -1,4 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf32btsmip.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes

View File

@ -1,5 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf32btsmipn32.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes
ALIGNMENT=8

View File

@ -1,4 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf32ltsmip.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes

View File

@ -1,5 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf32ltsmipn32.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes
ALIGNMENT=8

View File

@ -1,4 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf64btsmip.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes

View File

@ -1,4 +0,0 @@
# $FreeBSD$
. ${srcdir}/emulparams/elf64ltsmip.sh
. ${srcdir}/emulparams/elf_fbsd.sh
GENERATE_PIE_SCRIPT=yes

View File

@ -1,240 +0,0 @@
#!/bin/sh
# genscripts.sh - generate the ld-emulation-target specific files
#
# Usage: genscripts.sh srcdir libdir host target target_alias \
# default_emulation native_lib_dirs this_emulation
#
# Sample usage:
# genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib sparc-sun-sunos4.1.3 \
# sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 "" sun3 sparc-sun-sunos4.1.3
# produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c
#
# $FreeBSD$
#
# This is a cut-down version of the GNU script. Instead of jumping through
# hoops for all possible combinations of paths, just use the libdir
# argument in place of LIB_PATH.
#
# The exec_prefix, target_alias, use_sysroot, NATIVE_LIB_DIRS, TOOL_LIB, CUSTOMIZER_SCRIPT
# arguments are not used in this version.
#
srcdir=$1
libdir=$2
exec_prefix=$3
host=$4
target=$5
target_alias=$6
EMULATION_LIBPATH=$7
NATIVE_LIB_DIRS=$8
use_sysroot=$9
shift 9
EMULATION_NAME=$1
TOOL_LIB=$2
CUSTOMIZER_SCRIPT=$3
# Create the 'CUSTOMIZER_SCRIPT' knob to better sync this script with
# FSF BU ver 2.15 which allows for a more generic emulparams processing.
# To reduce the diff, I also include the ${EMULATION_NAME} parameter in uses
# of 'CUSTOMIZER_SCRIPT'.
# XXX: arm hack : until those file are merged back into the FSF repo, just
# use the version in this directory.
if !(test -f ${CUSTOMIZER_SCRIPT}"";) then
CUSTOMIZER_SCRIPT="${srcdir}/emulparams/${EMULATION_NAME}.sh"
fi
# Include the emulation-specific parameters:
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
if test -d ldscripts; then
true
else
mkdir -p ldscripts
fi
# Set some flags for the emultempl scripts. USE_LIBPATH will
# be set for any libpath-using emulation; NATIVE will be set for a
# emulation to enable 'LD_LIBRARY_PATH=/foo:/bar ld -lfooz'
if [ "x${host}" = "x${target}" ] ; then
NATIVE=yes
fi
USE_LIBPATH=yes
# Set the library search path, for libraries named by -lfoo.
# If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
# Otherwise, the default is set here.
#
# The format is the usual list of colon-separated directories.
# To force a logically empty LIB_PATH, do LIBPATH=":".
LIB_SEARCH_DIRS=`echo ${libdir} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'`
# Generate 5 or 6 script files from a master script template in
# ${srcdir}/scripttempl/${SCRIPT_NAME}.sh. Which one of the 5 or 6
# script files is actually used depends on command line options given
# to ld. (SCRIPT_NAME was set in the emulparams_file.)
#
# 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 .xbn script is for linking with -N flag (mix text and data on same page).
# A .xs script is for generating a shared library with the --shared
# flag; it is only generated if $GENERATE_SHLIB_SCRIPT is set by the
# emulation parameters.
# A .xc script is for linking with -z combreloc; it is only generated if
# $GENERATE_COMBRELOC_SCRIPT is set by the emulation parameters or
# $SCRIPT_NAME is "elf".
# A .xsc script is for linking with --shared -z combreloc; it is generated
# if $GENERATE_COMBRELOC_SCRIPT is set by the emulation parameters or
# $SCRIPT_NAME is "elf" and $GENERATE_SHLIB_SCRIPT is set by the emulation
# parameters too.
if [ "x$SCRIPT_NAME" = "xelf" ]; then
GENERATE_COMBRELOC_SCRIPT=yes
fi
SEGMENT_SIZE=${SEGMENT_SIZE-${MAXPAGESIZE-${TARGET_PAGE_SIZE}}}
# Determine DATA_ALIGNMENT for the 5 variants, using
# values specified in the emulparams/<script_to_run>.sh file or default.
DATA_ALIGNMENT_="${DATA_ALIGNMENT_-${DATA_ALIGNMENT-ALIGN(${SEGMENT_SIZE})}}"
DATA_ALIGNMENT_n="${DATA_ALIGNMENT_n-${DATA_ALIGNMENT_}}"
DATA_ALIGNMENT_N="${DATA_ALIGNMENT_N-${DATA_ALIGNMENT-.}}"
DATA_ALIGNMENT_r="${DATA_ALIGNMENT_r-${DATA_ALIGNMENT-}}"
DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
LD_FLAG=r
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
( echo "/* Script for ld -r: link without relocation */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xr
LD_FLAG=u
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
CONSTRUCTING=" "
( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
LD_FLAG=
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
RELOCATING=" "
( echo "/* Default linker script, for normal executables */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.x
LD_FLAG=n
DATA_ALIGNMENT=${DATA_ALIGNMENT_n}
TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}}
( echo "/* Script for -n: mix text and data on same page */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xn
LD_FLAG=N
DATA_ALIGNMENT=${DATA_ALIGNMENT_N}
( echo "/* Script for -N: mix text and data on same page; don't align data */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xbn
if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
DATA_ALIGNMENT=${DATA_ALIGNMENT_c-${DATA_ALIGNMENT_}}
LD_FLAG=c
COMBRELOC=ldscripts/${EMULATION_NAME}.xc.tmp
( echo "/* Script for -z combreloc: combine and sort reloc sections */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xc
rm -f ${COMBRELOC}
LD_FLAG=w
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xw.tmp
( echo "/* Script for -z combreloc -z now -z relro: combine and sort reloc sections */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xw
rm -f ${COMBRELOC}
COMBRELOC=
unset RELRO_NOW
fi
if test -n "$GENERATE_SHLIB_SCRIPT"; then
LD_FLAG=shared
DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}}
CREATE_SHLIB=" "
# Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR.
(
echo "/* Script for ld --shared: link shared library */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xs
if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
LD_FLAG=cshared
DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}}
COMBRELOC=ldscripts/${EMULATION_NAME}.xsc.tmp
( echo "/* Script for --shared -z combreloc: shared library, combine & sort relocs */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsc
rm -f ${COMBRELOC}
LD_FLAG=wshared
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xsw.tmp
( echo "/* Script for --shared -z combreloc -z now -z relro: shared library, combine & sort relocs */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsw
rm -f ${COMBRELOC}
COMBRELOC=
unset RELRO_NOW
fi
unset CREATE_SHLIB
fi
if test -n "$GENERATE_PIE_SCRIPT"; then
LD_FLAG=pie
DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}}
CREATE_PIE=" "
# Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR.
(
echo "/* Script for ld -pie: link position independent executable */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xd
if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
LD_FLAG=cpie
DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}}
COMBRELOC=ldscripts/${EMULATION_NAME}.xdc.tmp
( echo "/* Script for -pie -z combreloc: position independent executable, combine & sort relocs */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdc
rm -f ${COMBRELOC}
LD_FLAG=wpie
RELRO_NOW=" "
COMBRELOC=ldscripts/${EMULATION_NAME}.xdw.tmp
( echo "/* Script for -pie -z combreloc -z now -z relro: position independent executable, combine & sort relocs */"
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdw
rm -f ${COMBRELOC}
COMBRELOC=
unset RELRO_NOW
fi
unset CREATE_PIE
fi
case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) COMPILE_IN=true;;
esac
# Generate e${EMULATION_NAME}.c.
. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em

File diff suppressed because it is too large Load Diff