aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl/pe.sc
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 /ld/scripttempl/pe.sc
parentdb434ba03edb5491d48415069d6116b5037e6fa1 (diff)
downloadgdb-5063daf7357ccdc2c9e899ca0421c2e8e580c88d.zip
gdb-5063daf7357ccdc2c9e899ca0421c2e8e580c88d.tar.gz
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.
Diffstat (limited to 'ld/scripttempl/pe.sc')
-rw-r--r--ld/scripttempl/pe.sc34
1 files changed, 23 insertions, 11 deletions
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)} :
{