+2021-01-26 Alan Modra <amodra@gmail.com>
+
+ PR 27226
+ * emulparams/alphavms.sh: Don't set COMPILE_IN.
+ * emulparams/elf64_ia64_vms.sh: Likewise.
+ * emulparams/elf64mmix.sh: Likewise.
+ * emulparams/elf_iamcu.sh: Likewise.
+ * emulparams/elf_k1om.sh: Likewise.
+ * emulparams/elf_l1om.sh: Likewise.
+ * emulparams/mmo.sh: Likewise.
+ * emulparams/pdp11.sh: Set DATA_SEG_ADDR.
+ * scripttempl/pdp11.sc: Use it.
+ * emultempl/pdp11.em: Don't edit .xn script for separate_code,
+ instead use .xe script. Support scripts from file system.
+ * emultempl/beos.em: Support scripts from file system.
+ * emultempl/pe.em: Likewise.
+ * emultempl/pep.em: Likewise.
+ * testsuite/ld-bootstrap/bootstrap.exp: Make tmpdir/ldscripts link.
+
2021-01-25 Fangrui Song <maskray@google.com>
PR ld/27230
OUTPUT_FORMAT="vms-alpha"
ARCH=alpha
-COMPILE_IN=yes
-EXTRA_EM_FILE=vms
\ No newline at end of file
+EXTRA_EM_FILE=vms
OUTPUT_FORMAT="elf64-ia64-vms"
ARCH=ia64
-COMPILE_IN=yes
EXTRA_EM_FILE=vms
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ARCH=mmix
MACHINE=
-COMPILE_IN=yes
EXTRA_EM_FILE=mmixelf
# The existence of a symbol __start (or _start) should overrule Main, so
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH=iamcu
MACHINE=
-COMPILE_IN=yes
TEMPLATE_NAME=elf
EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="k1om"
MACHINE=
-COMPILE_IN=yes
TEMPLATE_NAME=elf
EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ARCH="l1om"
MACHINE=
-COMPILE_IN=yes
TEMPLATE_NAME=elf
EXTRA_EM_FILE="elf-x86"
GENERATE_SHLIB_SCRIPT=yes
OUTPUT_FORMAT=mmo
RELOCATEABLE_OUTPUT_FORMAT=elf64-mmix
ARCH=mmix
-COMPILE_IN=yes
EXTRA_EM_FILE=mmo
TARGET_PAGE_SIZE=8192
EXTRA_EM_FILE=pdp11
ARCH=pdp11
+
+case "$LD_FLAG" in
+ *textonly) DATA_SEG_ADDR=0 ;;
+ *) DATA_SEG_ADDR=$DATA_ALIGNMENT ;;
+esac
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"
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
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"
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
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} */
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"
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
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"
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
${RELOCATING+__etext = .;}
${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
}
- ${RELOCATING+. = ${DATA_ALIGNMENT};}
+ ${RELOCATING+. = ${DATA_SEG_ADDR};}
.data :
{
*(.data)
set gcc_B_opt_save $gcc_B_opt
+catch "exec ln -s ../ldscripts tmpdir/ldscripts" status
foreach ldexe {ld1 ld2 ld3} {
if {![file isdirectory tmpdir/gcc$ldexe]} then {
catch "exec mkdir tmpdir/gcc$ldexe" status