aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-02-27 14:09:29 +0000
committerNick Clifton <nickc@redhat.com>2014-02-27 14:13:43 +0000
commit5063daf7357ccdc2c9e899ca0421c2e8e580c88d (patch)
treead294aff0d6abde7e8064a16f4503d01dfe90867
parentdb434ba03edb5491d48415069d6116b5037e6fa1 (diff)
downloadfsf-binutils-gdb-5063daf7357ccdc2c9e899ca0421c2e8e580c88d.zip
fsf-binutils-gdb-5063daf7357ccdc2c9e899ca0421c2e8e580c88d.tar.gz
fsf-binutils-gdb-5063daf7357ccdc2c9e899ca0421c2e8e580c88d.tar.bz2
This patch adds a default manifest in to the final links performed by the Cygwin and MinGW targets.
The manifest is necessary in order for the linked binaries to be executed in a Windows 8 environment. The manifest is added using a linker script so that this feature will be compiler-neutral. The resource merging code in the linker means that if an application provides its own manifest then the default manifest will be ignored. * configure.in (all_emul_extra_binaries): New variable. Populated by invoking configure.tgt. (EMUL_EXTRA_BINARIES): New substitution. * configure: Regenerate. * configure.tgt (target_extra_binaries): New variable. Set to default-manifest.o for Cygwin and MinGW targets. * Makefile.am (EMUL_EXTRA_BINARIES): New variable. Initialised by the configure script. (ALL_EMUL_EXTRA_BINARIES): New variable. (default-manifest.o): New rule to build the default manifest. (ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES. (install-data-local): Add EMUL_EXTRA_BINARIES. * Makefile.in: Regenerate. * ld.texinfo: Document default manifest support. * emulparams/i386pe.sh (DEFAULT_MANIFEST): Define. * emulparams/i386pep.sh (DEFAULT_MANIFEST): Define. * emultempl/default-manifest.rc: New file. * scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined. * scripttempl/pep.sc (R_RSRC): Likewise. * ld-pe/longsecn-1.d: Allow for extra sections. * ld-pe/longsecn-2.d: Likewise. * ld-pe/longsecn.d: Likewise. * ld-pe/secrel.d: Likewise.
-rw-r--r--ld/ChangeLog22
-rw-r--r--ld/Makefile.am16
-rw-r--r--ld/Makefile.in17
-rwxr-xr-xld/configure18
-rw-r--r--ld/configure.in13
-rw-r--r--ld/configure.tgt12
-rw-r--r--ld/emulparams/i386pe.sh1
-rw-r--r--ld/emulparams/i386pep.sh1
-rw-r--r--ld/emultempl/default-manifest.rc28
-rw-r--r--ld/ld.texinfo9
-rw-r--r--ld/scripttempl/pe.sc34
-rw-r--r--ld/scripttempl/pep.sc34
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-pe/longsecn-1.d2
-rw-r--r--ld/testsuite/ld-pe/longsecn-2.d1
-rw-r--r--ld/testsuite/ld-pe/longsecn.d2
-rw-r--r--ld/testsuite/ld-pe/secrel.d1
17 files changed, 184 insertions, 34 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index cc814c9..a0c5284 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -8,6 +8,28 @@
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Exclude
-secure-plt, -bss-plt and -sdata-got when vxworks.
+2014-02-27 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (all_emul_extra_binaries): New variable. Populated
+ by invoking configure.tgt.
+ (EMUL_EXTRA_BINARIES): New substitution.
+ * configure: Regenerate.
+ * configure.tgt (target_extra_binaries): New variable. Set to
+ default-manifest.o for Cygwin and MinGW targets.
+ * Makefile.am (EMUL_EXTRA_BINARIES): New variable. Initialised
+ by the configure script.
+ (ALL_EMUL_EXTRA_BINARIES): New variable.
+ (default-manifest.o): New rule to build the default manifest.
+ (ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES.
+ (install-data-local): Add EMUL_EXTRA_BINARIES.
+ * Makefile.in: Regenerate.
+ * ld.texinfo: Document default manifest support.
+ * emulparams/i386pe.sh (DEFAULT_MANIFEST): Define.
+ * emulparams/i386pep.sh (DEFAULT_MANIFEST): Define.
+ * emultempl/default-manifest.rc: New file.
+ * scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined.
+ * scripttempl/pep.sc (R_RSRC): Likewise.
+
2014-02-26 Dan Mick <dan.mick@inktank.com>
PR ld/16569
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 5968668..e15dfac 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -59,6 +59,8 @@ scriptdir = $(tooldir)/lib
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
EMUL_EXTRA_OFILES = @EMUL_EXTRA_OFILES@
+EMUL_EXTRA_BINARIES = @EMUL_EXTRA_BINARIES@
+
# Search path to override the default search path for -lfoo libraries.
# If LIB_PATH is empty, the ones in the script (if any) are left alone.
@@ -489,6 +491,9 @@ ALL_EMUL_EXTRA_OFILES = \
pe-dll.@OBJEXT@ \
pep-dll.@OBJEXT@
+ALL_EMUL_EXTRA_BINARIES = \
+ default-manifest.@OBJEXT@
+
CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
mri.c ldcref.c pe-dll.c pep-dll.c ldlex-wrapper.c \
@@ -1921,6 +1926,10 @@ eshlelf64_nbsd.c: $(srcdir)/emulparams/shlelf64_nbsd.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} shlelf64_nbsd "$(tdir_shlelf64_nbsd)"
+# Rule to create a manifest file for Cygwin and Mingw.
+default-manifest.o: $(srcdir)/emultempl/default-manifest.rc
+ ../binutils/windres -o $@ $<
+
# We need this for automake to use YLWRAP.
EXTRA_ld_new_SOURCES = deffilep.y ldlex.l
# Allow dependency tracking to work for these files, too.
@@ -1928,7 +1937,8 @@ EXTRA_ld_new_SOURCES += pep-dll.c pe-dll.c
ld_new_SOURCES = ldgram.y ldlex-wrapper.c lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c $(PLUGIN_C)
-ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL_DEP)
+ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(EMUL_EXTRA_BINARIES) \
+ $(BFDLIB) $(LIBIBERTY) $(LIBINTL_DEP)
ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
# Dependency tracking for the generated emulation files.
@@ -2074,9 +2084,9 @@ install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
fi; \
fi
-install-data-local:
+install-data-local: $(EMUL_EXTRA_BINARIES)
$(mkinstalldirs) $(DESTDIR)$(scriptdir)/ldscripts
- for f in ldscripts/*; do \
+ for f in ldscripts/* $(EMUL_EXTRA_BINARIES); do \
$(INSTALL_DATA) $$f $(DESTDIR)$(scriptdir)/$$f ; \
done
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 59cba73..1a3d9ac 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -219,6 +219,7 @@ EGREP = @EGREP@
EMUL = @EMUL@
EMULATION_LIBPATH = @EMULATION_LIBPATH@
EMULATION_OFILES = @EMULATION_OFILES@
+EMUL_EXTRA_BINARIES = @EMUL_EXTRA_BINARIES@
EMUL_EXTRA_OFILES = @EMUL_EXTRA_OFILES@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
@@ -388,6 +389,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
scriptdir = $(tooldir)/lib
+EMUL_DEPS =
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
@@ -795,6 +797,9 @@ ALL_EMUL_EXTRA_OFILES = \
pe-dll.@OBJEXT@ \
pep-dll.@OBJEXT@
+ALL_EMUL_EXTRA_BINARIES = \
+ default-manifest.@OBJEXT@
+
CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
mri.c ldcref.c pe-dll.c pep-dll.c ldlex-wrapper.c \
@@ -838,7 +843,9 @@ EXTRA_ld_new_SOURCES = deffilep.y ldlex.l pep-dll.c pe-dll.c \
ld_new_SOURCES = ldgram.y ldlex-wrapper.c lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c $(PLUGIN_C)
-ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL_DEP)
+ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(EMUL_EXTRA_BINARIES) \
+ $(BFDLIB) $(LIBIBERTY) $(LIBINTL_DEP)
+
ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
# A test program for C++ constructors and destructors.
@@ -3353,6 +3360,10 @@ eshlelf64_nbsd.c: $(srcdir)/emulparams/shlelf64_nbsd.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} shlelf64_nbsd "$(tdir_shlelf64_nbsd)"
+# Rule to create a manifest file for Cygwin and Mingw.
+default-manifest.o: $(srcdir)/emultempl/default-manifest.rc
+ ../binutils/windres -o $@ $<
+
check-DEJAGNU: site.exp
srcroot=`cd $(srcdir) && pwd`; export srcroot; \
r=`pwd`; export r; \
@@ -3438,9 +3449,9 @@ install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
fi; \
fi
-install-data-local:
+install-data-local: $(EMUL_EXTRA_BINARIES)
$(mkinstalldirs) $(DESTDIR)$(scriptdir)/ldscripts
- for f in ldscripts/*; do \
+ for f in ldscripts/* $(EMUL_EXTRA_BINARIES); do \
$(INSTALL_DATA) $$f $(DESTDIR)$(scriptdir)/$$f ; \
done
diststuff: info $(EXTRA_DIST)
diff --git a/ld/configure b/ld/configure
index 8452a13..30c6a36 100755
--- a/ld/configure
+++ b/ld/configure
@@ -605,6 +605,7 @@ LIBOBJS
TESTBFDLIB
EMULATION_LIBPATH
LIB_PATH
+EMUL_EXTRA_BINARIES
EMUL_EXTRA_OFILES
EMULATION_OFILES
EMUL
@@ -12193,7 +12194,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12196 "configure"
+#line 12197 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12299,7 +12300,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12302 "configure"
+#line 12303 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16837,6 +16838,7 @@ all_targets=
EMUL=
all_emuls=
all_emul_extras=
+all_emul_extra_binaries=
all_libpath=
rm -f tdirs
@@ -16944,6 +16946,15 @@ do
;;
esac
done
+
+ for i in $targ_extra_binaries; do
+ case " $all_emul_extra_binaries " in
+ *" ${i} "*) ;;
+ *)
+ all_emul_extra_binaries="$all_emul_extra_binaries ${i}"
+ ;;
+ esac
+ done
fi
done
@@ -16959,14 +16970,17 @@ if test x${all_targets} = xtrue; then
EMULATION_OFILES='$(ALL_EMULATIONS)'
fi
EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
+ EMUL_EXTRA_BINARIES='$(ALL_EMUL_EXTRA_BINARIES)'
else
EMULATION_OFILES=$all_emuls
EMUL_EXTRA_OFILES=$all_emul_extras
+ EMUL_EXTRA_BINARIES=$all_emul_extra_binaries
fi
+
EMULATION_LIBPATH=$all_libpath
diff --git a/ld/configure.in b/ld/configure.in
index 619c151..26ac582 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -275,6 +275,7 @@ all_targets=
EMUL=
all_emuls=
all_emul_extras=
+all_emul_extra_binaries=
all_libpath=
dnl We need to get an arbitrary number of tdir definitions into
@@ -353,6 +354,15 @@ do
;;
esac
done
+
+ for i in $targ_extra_binaries; do
+ case " $all_emul_extra_binaries " in
+ *" ${i} "*) ;;
+ *)
+ all_emul_extra_binaries="$all_emul_extra_binaries ${i}"
+ ;;
+ esac
+ done
fi
done
@@ -368,12 +378,15 @@ if test x${all_targets} = xtrue; then
EMULATION_OFILES='$(ALL_EMULATIONS)'
fi
EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
+ EMUL_EXTRA_BINARIES='$(ALL_EMUL_EXTRA_BINARIES)'
else
EMULATION_OFILES=$all_emuls
EMUL_EXTRA_OFILES=$all_emul_extras
+ EMUL_EXTRA_BINARIES=$all_emul_extra_binaries
fi
AC_SUBST(EMULATION_OFILES)
AC_SUBST(EMUL_EXTRA_OFILES)
+AC_SUBST(EMUL_EXTRA_BINARIES)
AC_SUBST(LIB_PATH)
EMULATION_LIBPATH=$all_libpath
diff --git a/ld/configure.tgt b/ld/configure.tgt
index c2c3eab..2f7d60a 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -26,7 +26,8 @@
# targ_emul name of linker emulation to use
# targ_extra_emuls additional linker emulations to provide
# targ_extra_libpath additional linker emulations using LIB_PATH
-# targ_extra_ofiles additional objects needed by the emulation
+# targ_extra_ofiles additional host-compiled objects needed by the emulation
+# targ_extra_binaries additional target-built binaries needed by the emulation
# targ64_extra_emuls additional linker emulations to provide if
# --enable-64-bit-bfd is given or if host is 64 bit.
# targ64_extra_libpath additional linker emulations using LIB_PATH if
@@ -309,23 +310,30 @@ i[3-7]86-*-gnu*) targ_emul=elf_i386 ;;
i[3-7]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;;
i[3-7]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;;
i[3-7]86-*-winnt*) targ_emul=i386pe ;
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3-7]86-*-pe) targ_emul=i386pe ;
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3-7]86-*-cygwin*) targ_emul=i386pe ;
- targ_extra_ofiles="deffilep.o pe-dll.o"
+ targ_extra_binaries="default-manifest.o" ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;
test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
i[3-7]86-*-mingw32*) targ_emul=i386pe ;
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
targ_extra_emuls=i386pe ;
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
x86_64-*-cygwin) targ_emul=i386pep ;
targ_extra_emuls=i386pe
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
x86_64-*-mingw*) targ_emul=i386pep ;
targ_extra_emuls=i386pe
+ targ_extra_binaries="default-manifest.o" ;
targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
i[3-7]86-*-interix*) targ_emul=i386pe_posix;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
diff --git a/ld/emulparams/i386pe.sh b/ld/emulparams/i386pe.sh
index 38191ec..6e3c790 100644
--- a/ld/emulparams/i386pe.sh
+++ b/ld/emulparams/i386pe.sh
@@ -7,3 +7,4 @@ SUBSYSTEM=PE_DEF_SUBSYSTEM
INITIAL_SYMBOL_CHAR=\"_\"
TARGET_PAGE_SIZE=0x1000
GENERATE_AUTO_IMPORT_SCRIPT=1
+DEFAULT_MANIFEST="default-manifest.o"
diff --git a/ld/emulparams/i386pep.sh b/ld/emulparams/i386pep.sh
index 76a9802..c84ce44 100644
--- a/ld/emulparams/i386pep.sh
+++ b/ld/emulparams/i386pep.sh
@@ -7,3 +7,4 @@ SUBSYSTEM=PE_DEF_SUBSYSTEM
INITIAL_SYMBOL_CHAR=\"_\"
TARGET_PAGE_SIZE=0x1000
GENERATE_AUTO_IMPORT_SCRIPT=1
+DEFAULT_MANIFEST="default-manifest.o"
diff --git a/ld/emultempl/default-manifest.rc b/ld/emultempl/default-manifest.rc
new file mode 100644
index 0000000..a4d303f
--- /dev/null
+++ b/ld/emultempl/default-manifest.rc
@@ -0,0 +1,28 @@
+LANGUAGE 0, 0
+
+/* CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST MOVEABLE PURE DISCARDABLE */
+1 9 MOVEABLE PURE DISCARDABLE
+BEGIN
+ "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>\n"
+ "<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">\n"
+ " <trustInfo xmlns=""urn:schemas-microsoft-com:asm.v3"">\n"
+ " <security>\n"
+ " <requestedPrivileges>\n"
+ " <requestedExecutionLevel level=""asInvoker""/>\n"
+ " </requestedPrivileges>\n"
+ " </security>\n"
+ " </trustInfo>\n"
+ " <compatibility xmlns=""urn:schemas-microsoft-com:compatibility.v1"">\n"
+ " <application>\n"
+ " <!--The ID below indicates application support for Windows Vista -->\n"
+ " <supportedOS Id=""{e2011457-1546-43c5-a5fe-008deee3d3f0}""/>\n"
+ " <!--The ID below indicates application support for Windows 7 -->\n"
+ " <supportedOS Id=""{35138b9a-5d96-4fbd-8e2d-a2440225f93a}""/>\n"
+ " <!--The ID below indicates application support for Windows 8 -->\n"
+ " <supportedOS Id=""{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}""/>\n"
+ " <!--The ID below indicates application support for Windows 8.1 -->\n"
+ " <supportedOS Id=""{1f676c76-80e1-4239-95bb-83d0f6d0da78}""/> \n"
+ " </application>\n"
+ " </compatibility>\n"
+ "</assembly>\n"
+END
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index bfc2643..b1dff79 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -7585,6 +7585,15 @@ by @command{ld} and respected when laying out the common symbols. Native
tools will be able to process object files employing this GNU extension,
but will fail to respect the alignment instructions, and may issue noisy
warnings about unknown linker directives.
+
+@cindex default manifest
+@item default manifest
+The linker will automatically add a default manifest to the .rsrc
+section of any fully linked cygwin or MingGW binary. This manifest is
+necessary in order to be able to execute the binary under Windows 8
+(or later). An application can supply its own manifest, and if it
+does so then this manifest will be used in preference to the default
+one.
@end table
@ifclear GENERIC
diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
index 59ce042..6cf59ea 100644
--- a/ld/scripttempl/pe.sc
+++ b/ld/scripttempl/pe.sc
@@ -39,12 +39,25 @@ if test "${RELOCATING}"; then
R_CRT_XP='*(SORT(.CRT$XP*)) /* Pre-termination */'
R_CRT_XT='*(SORT(.CRT$XT*)) /* Termination */'
R_TLS='
- *(.tls$AAA)
+ *(.tls$AAA)
*(.tls)
*(.tls$)
*(SORT(.tls$*))
*(.tls$ZZZ)'
- R_RSRC='*(SORT(.rsrc$*))'
+ if test -z "$DEFAULT_MANIFEST"; then
+ R_RSRC='
+ *(.rsrc)
+ *(SORT(.rsrc$*))'
+ else
+ R_RSRC="
+ /* The default manifest contains information necessary for
+ binaries to run under Windows 8 (or later). It is included as
+ the last resource file so that if the application has provided
+ its own manifest then that one will take precedence. */
+ *(EXCLUDE_FILE ($DEFAULT_MANIFEST) .rsrc)
+ *(SORT(.rsrc*))
+ KEEP ($DEFAULT_MANIFEST(.rsrc))"
+ fi
else
R_TEXT=
R_DATA=
@@ -53,7 +66,7 @@ else
R_IDATA5=
R_IDATA67=
R_CRT=
- R_RSRC=
+ R_RSRC='*(.rsrc)'
fi
cat <<EOF
@@ -69,7 +82,7 @@ SECTIONS
${RELOCATING+ lower than the target page size. */}
${RELOCATING+. = SIZEOF_HEADERS;}
${RELOCATING+. = ALIGN(__section_alignment__);}
- .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
+ .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
{
${RELOCATING+ *(.init)}
*(.text)
@@ -78,9 +91,9 @@ SECTIONS
${RELOCATING+ *(.gnu.linkonce.t.*)}
*(.glue_7t)
*(.glue_7)
- ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+ ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); }
- ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+ ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); }
${RELOCATING+ *(.fini)}
/* ??? Why is .gcc_exc here? */
@@ -96,7 +109,7 @@ SECTIONS
breaks building the cygwin32 dll. Instead, we name the section
".data_cygwin_nocopy" and explicitly include it after __data_end__. */
- .data ${RELOCATING+BLOCK(__section_alignment__)} :
+ .data ${RELOCATING+BLOCK(__section_alignment__)} :
{
${RELOCATING+__data_start__ = . ;}
*(.data)
@@ -202,13 +215,12 @@ SECTIONS
}
.rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- *(.rsrc)
+ {
${R_RSRC}
}
.reloc ${RELOCATING+BLOCK(__section_alignment__)} :
- {
+ {
*(.reloc)
}
@@ -226,7 +238,7 @@ SECTIONS
Symbols in the DWARF debugging sections are relative to the beginning
of the section. Unlike other targets that fake this by putting the
section VMA at 0, the PE format will not allow it. */
-
+
/* DWARF 1.1 and DWARF 2. */
.debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
{
diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
index 884baaf..324a743 100644
--- a/ld/scripttempl/pep.sc
+++ b/ld/scripttempl/pep.sc
@@ -39,12 +39,25 @@ if test "${RELOCATING}"; then
R_CRT_XP='*(SORT(.CRT$XP*)) /* Pre-termination */'
R_CRT_XT='*(SORT(.CRT$XT*)) /* Termination */'
R_TLS='
- *(.tls$AAA)
+ *(.tls$AAA)
*(.tls)
*(.tls$)
*(SORT(.tls$*))
*(.tls$ZZZ)'
- R_RSRC='*(SORT(.rsrc$*))'
+ if test -z "$DEFAULT_MANIFEST"; then
+ R_RSRC='
+ *(.rsrc)
+ *(SORT(.rsrc$*))'
+ else
+ R_RSRC="
+ /* The default manifest contains information necessary for
+ binaries to run under Windows 8 (or later). It is included as
+ the last resource file so that if the application has provided
+ its own manifest then that one will take precedence. */
+ *(EXCLUDE_FILE ($DEFAULT_MANIFEST) .rsrc)
+ *(SORT(.rsrc*))
+ KEEP ($DEFAULT_MANIFEST(.rsrc))"
+ fi
else
R_TEXT=
R_DATA=
@@ -53,7 +66,7 @@ else
R_IDATA5=
R_IDATA67=
R_CRT=
- R_RSRC=
+ R_RSRC='*(.rsrc)'
fi
cat <<EOF
@@ -69,7 +82,7 @@ SECTIONS
${RELOCATING+ lower than the target page size. */}
${RELOCATING+. = SIZEOF_HEADERS;}
${RELOCATING+. = ALIGN(__section_alignment__);}
- .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
+ .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
{
${RELOCATING+ *(.init)}
*(.text)
@@ -79,9 +92,9 @@ SECTIONS
*(.glue_7t)
*(.glue_7)
${CONSTRUCTING+. = ALIGN(8);}
- ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+ ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1); LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); LONG (0); }
- ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+ ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); LONG (0); }
${RELOCATING+ *(.fini)}
/* ??? Why is .gcc_exc here? */
@@ -96,7 +109,7 @@ SECTIONS
breaks building the cygwin32 dll. Instead, we name the section
".data_cygwin_nocopy" and explicitly include it after __data_end__. */
- .data ${RELOCATING+BLOCK(__section_alignment__)} :
+ .data ${RELOCATING+BLOCK(__section_alignment__)} :
{
${RELOCATING+__data_start__ = . ;}
*(.data)
@@ -207,13 +220,12 @@ SECTIONS
}
.rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- *(.rsrc)
+ {
${R_RSRC}
}
.reloc ${RELOCATING+BLOCK(__section_alignment__)} :
- {
+ {
*(.reloc)
}
@@ -231,7 +243,7 @@ SECTIONS
Symbols in the DWARF debugging sections are relative to the beginning
of the section. Unlike other targets that fake this by putting the
section VMA at 0, the PE format will not allow it. */
-
+
/* DWARF 1.1 and DWARF 2. */
.debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
{
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 5e53f4a..1af8109 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-27 Nick Clifton <nickc@redhat.com>
+
+ * ld-pe/longsecn-1.d: Allow for extra sections.
+ * ld-pe/longsecn-2.d: Likewise.
+ * ld-pe/longsecn.d: Likewise.
+ * ld-pe/secrel.d: Likewise.
+
2014-02-21 Alan Modra <amodra@gmail.com>
* ld-bootstrap/bootstrap.exp: Add ppc476 workaround test.
diff --git a/ld/testsuite/ld-pe/longsecn-1.d b/ld/testsuite/ld-pe/longsecn-1.d
index 95b3337..81a44a7 100644
--- a/ld/testsuite/ld-pe/longsecn-1.d
+++ b/ld/testsuite/ld-pe/longsecn-1.d
@@ -19,4 +19,4 @@ Idx Name Size VMA +LMA +File off Algn
CONTENTS, ALLOC, LOAD, DATA
5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9]
CONTENTS, ALLOC, LOAD, DATA
-
+#...
diff --git a/ld/testsuite/ld-pe/longsecn-2.d b/ld/testsuite/ld-pe/longsecn-2.d
index 8170006..64d1627 100644
--- a/ld/testsuite/ld-pe/longsecn-2.d
+++ b/ld/testsuite/ld-pe/longsecn-2.d
@@ -19,3 +19,4 @@ Idx Name Size VMA +LMA +File off Algn
CONTENTS, ALLOC, LOAD, DATA
5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9]
CONTENTS, ALLOC, LOAD, DATA
+#...
diff --git a/ld/testsuite/ld-pe/longsecn.d b/ld/testsuite/ld-pe/longsecn.d
index 2dcde35..e77f6ee 100644
--- a/ld/testsuite/ld-pe/longsecn.d
+++ b/ld/testsuite/ld-pe/longsecn.d
@@ -19,4 +19,4 @@ Idx Name Size VMA +LMA +File off Algn
CONTENTS, ALLOC, LOAD, DATA
5 \.idata [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ 2\*\*[0-9]
CONTENTS, ALLOC, LOAD, DATA
-
+#...
diff --git a/ld/testsuite/ld-pe/secrel.d b/ld/testsuite/ld-pe/secrel.d
index b924f54..3f1bb4a 100644
--- a/ld/testsuite/ld-pe/secrel.d
+++ b/ld/testsuite/ld-pe/secrel.d
@@ -25,3 +25,4 @@ Contents of section \.rdata:
Contents of section \.idata:
.*4000 00000000 00000000 00000000 00000000 ................
.*4010 00000000 ....
+#...