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.
This commit is contained in:
Nick Clifton
2014-02-27 14:09:29 +00:00
parent db434ba03e
commit 5063daf735
17 changed files with 184 additions and 34 deletions

18
ld/configure vendored
View File

@@ -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