aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/beos.em25
-rw-r--r--ld/emultempl/pdp11.em30
-rw-r--r--ld/emultempl/pe.em34
-rw-r--r--ld/emultempl/pep.em34
4 files changed, 121 insertions, 2 deletions
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index bb4395f..fc43ce1 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -712,7 +712,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
static char *
gld_${EMULATION_NAME}_get_script (int *isfile)
EOF
+
+if test x"$COMPILE_IN" = xyes
+then
# Scripts compiled in.
+
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
@@ -734,6 +738,27 @@ 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.
+
+fragment <<EOF
+{
+ *isfile = 1;
+
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (bfd_link_relocatable (&link_info))
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+fi
+
fragment <<EOF
diff --git a/ld/emultempl/pdp11.em b/ld/emultempl/pdp11.em
index f725e73..6a3cacb 100644
--- a/ld/emultempl/pdp11.em
+++ b/ld/emultempl/pdp11.em
@@ -94,7 +94,11 @@ gld${EMULATION_NAME}_handle_option (int optc)
static char *
gld${EMULATION_NAME}_get_script (int *isfile)
EOF
+
+if test x"$COMPILE_IN" = xyes
+then
# Scripts compiled in.
+
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
@@ -109,8 +113,7 @@ sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c
-sed $sc ldscripts/${EMULATION_NAME}.xn | \
- sed -e "s/ALIGN($TARGET_PAGE_SIZE)/0/" >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xe >> 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
@@ -119,6 +122,29 @@ 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.
+
+fragment <<EOF
+{
+ *isfile = 1;
+
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (bfd_link_relocatable (&link_info))
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xe";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+fi
+
fragment <<EOF
/* --- \end{pdp11.em} */
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index f9060be..748a6b4 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -2355,7 +2355,11 @@ gld_${EMULATION_NAME}_find_potential_libraries
static char *
gld_${EMULATION_NAME}_get_script (int *isfile)
EOF
+
+if test x"$COMPILE_IN" = xyes
+then
# Scripts compiled in.
+
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
@@ -2381,6 +2385,36 @@ 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.
+
+fragment <<EOF
+{
+ *isfile = 1;
+
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (bfd_link_relocatable (&link_info))
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+EOF
+if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then
+fragment <<EOF
+ else if (link_info.pei386_auto_import == 1
+ && (MERGE_RDATA_V2 || link_info.pei386_runtime_pseudo_reloc != 2))
+ return "ldscripts/${EMULATION_NAME}.xa";
+EOF
+fi
+fragment <<EOF
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+fi
+
fragment <<EOF
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index ca335b5..ff49c15 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -2175,7 +2175,11 @@ gld_${EMULATION_NAME}_find_potential_libraries
static char *
gld_${EMULATION_NAME}_get_script (int *isfile)
EOF
+
+if test x"$COMPILE_IN" = xyes
+then
# Scripts compiled in.
+
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
@@ -2201,6 +2205,36 @@ 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.
+
+fragment <<EOF
+{
+ *isfile = 1;
+
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (bfd_link_relocatable (&link_info))
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+EOF
+if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then
+fragment <<EOF
+ else if (link_info.pei386_auto_import == 1
+ && link_info.pei386_runtime_pseudo_reloc != 2)
+ return "ldscripts/${EMULATION_NAME}.xa";
+EOF
+fi
+fragment <<EOF
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+fi
+
fragment <<EOF