summaryrefslogtreecommitdiff
path: root/bfd/peXXigen.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2007-11-13 20:17:43 +0000
committerH.J. Lu <hjl@lucon.org>2007-11-13 20:17:43 +0000
commit561d9e36e97eaed3b80b4079131a57a99d5f2e66 (patch)
tree771982265a32f2f54c33f983d19f14c9299ab411 /bfd/peXXigen.c
parent66a4a9224c87ac7e19ceab4bd1cba124db0267da (diff)
downloadbinutils-redhat-561d9e36e97eaed3b80b4079131a57a99d5f2e66.tar.gz
2007-11-13 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/5307 * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't copy input subsystem if output is different from input.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r--bfd/peXXigen.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 2d09561e33..ddba2354df 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1987,13 +1987,22 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
bfd_boolean
_bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
{
+ pe_data_type *ipe, *ope;
+
/* One day we may try to grok other private data. */
if (ibfd->xvec->flavour != bfd_target_coff_flavour
|| obfd->xvec->flavour != bfd_target_coff_flavour)
return TRUE;
- pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
- pe_data (obfd)->dll = pe_data (ibfd)->dll;
+ ipe = pe_data (ibfd);
+ ope = pe_data (obfd);
+
+ ope->pe_opthdr = ipe->pe_opthdr;
+ ope->dll = ipe->dll;
+
+ /* Don't copy input subsystem if output is different from input. */
+ if (obfd->xvec != ibfd->xvec)
+ ope->pe_opthdr.Subsystem = IMAGE_SUBSYSTEM_UNKNOWN;
/* For strip: if we removed .reloc, we'll make a real mess of things
if we don't remove this entry as well. */