From 325c681d94281b21b30dc18dd604a54e418df607 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 27 Apr 2009 13:59:43 +0000 Subject: [PATCH] bfd/ 2009-04-27 H.J. Lu * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't copy pe_opthdr. binutils/ 2009-04-27 H.J. Lu * objcopy.c (copy_object): Copy pe_opthdr before changing PE parameters. --- bfd/ChangeLog | 5 +++++ bfd/peXXigen.c | 2 +- binutils/ChangeLog | 5 +++++ binutils/objcopy.c | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bc34a78f711..194ba68afe0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2009-04-27 H.J. Lu + + * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't + copy pe_opthdr. + 2009-04-23 Matthias Klose * peXXigen.c (_bfd_XXi_swap_sym_in): Initialize `name'. diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 76224cb0906..4229de2e659 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -2188,7 +2188,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) ipe = pe_data (ibfd); ope = pe_data (obfd); - ope->pe_opthdr = ipe->pe_opthdr; + /* pe_opthdr is copied in copy_object. */ ope->dll = ipe->dll; /* Don't copy input subsystem if output is different from input. */ diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0e2d554d5c6..75af8f19002 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2009-04-27 H.J. Lu + + * objcopy.c (copy_object): Copy pe_opthdr before changing PE + parameters. + 2009-04-24 Cary Coutant * dwarf.c (process_extended_line_op): Add DW_LNE_set_discriminator. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 3fe874114db..7ef95c52c16 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1491,6 +1491,11 @@ copy_object (bfd *ibfd, bfd *obfd) /* Set up PE parameters. */ pe_data_type *pe = pe_data (obfd); + /* Copy PE parameters before changing them. */ + if (ibfd->xvec->flavour == bfd_target_coff_flavour + && bfd_pei_p (ibfd)) + pe->pe_opthdr = pe_data (ibfd)->pe_opthdr; + if (pe_file_alignment != (bfd_vma) -1) pe->pe_opthdr.FileAlignment = pe_file_alignment; else -- 2.30.2