Major rewrite of how ld is configured. The major idea
[deliverable/binutils-gdb.git] / ld / genscripts.sh
1 # This shell script does the work of generating the ld-emulation-target
2 # specific information from a specific file of paramaters.
3 # Usage: genscripts.sh srcdir host_alias target_alias emulation_name
4
5 srcdir=$1
6 host_alias=$2
7 target_alias=$3
8
9 # Include the emulation-specic parameters:
10 . ${srcdir}/$4
11
12 # Set the library search path (for libraries named by -lfoo).
13 # If LIB_PATH is defined (and non-empty), it is used.
14 # (The format is the usual list of colon-separated directories.)
15 # (To force a logically empty LIB_PATH, do LIBPATH=":".)
16 # Otherwise, the default is /lib:/usr/lib:/usr/local/lib,
17 # unless cross-compiling, in which case the default remains empty.
18
19 if [ "x${LIB_PATH}" = "x" -a "x${host_alias}" = "x${target_alias}" ] ; then
20 LIB_PATH=/lib:/usr/lib:/usr/local/lib
21 fi
22 LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'`
23
24 # This script generates 5 script files from the master script template
25 # in ${srcdir}/${SCRIPT_NAME}.sh. Which one of the 5 script files
26 # is actually used depends on command line flags given to ld.
27 # The actual script is filtered through the mkscript program
28 # to convert it to a form suitable for including in a C program
29 # as a C string literal.
30 #
31 # A .x script file is the default script.
32 # A .xr script is for linking without relocation (-r flag).
33 # A .xu script is like .xr, but *do* create constructors (-Ur flag).
34 # A .xn script is for linking with -n flag (mix text and data on same page).
35 # A .xN script is for linking with -N flag (mix text and data on same page).
36
37 THIS_TEXT_START_ADDR=${TEXT_START_ADDR}
38 SEGMENT_SIZE=${SEGMENT_SIZE-${PAGE_SIZE}}
39
40 DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
41 FILTER_SCRIPT=""
42 (. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \
43 >${EMULATION_NAME}.xr
44 CONSTRUCTING=
45 (. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \
46 >${EMULATION_NAME}.xu
47 RELOCATING=
48 (. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \
49 >${EMULATION_NAME}.x
50 THIS_TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}}
51 (. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \
52 >${EMULATION_NAME}.xn
53 DATA_ALIGNMENT="."
54 (. ${srcdir}/${SCRIPT_NAME}.sc-sh) | sed -e '/^ *$/d' | ./mkscript \
55 >${EMULATION_NAME}.xN
56
57 #sed -e s/"<ldtarget>"/${EMULATION_NAME}/g -e s/"<arch>"/${ARCH}/g \
58 # -e s/"<target>"/${EMULATION_NAME}/g -e s/"<target_name>"/${OUTPUT_FORMAT}/g \
59 # <${srcdir}/${TEMPLATE_NAME-ldtemplate} >ld__${EMULATION_NAME}.c
60
61 . ${srcdir}/${TEMPLATE_NAME-generic}.em
This page took 0.033271 seconds and 5 git commands to generate.