aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-12-12 14:41:15 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-12-12 14:41:15 -0800
commit57b828ef364b3cce05d9fb35be758cb4530e0e12 (patch)
tree51bfcdcc47a95c1cb2569937a11dc76290d9d7f9 /bfd
parent84b66498ef56905eb8ec15b94f3f06ddad978234 (diff)
downloadbinutils-57b828ef364b3cce05d9fb35be758cb4530e0e12.zip
binutils-57b828ef364b3cce05d9fb35be758cb4530e0e12.tar.gz
binutils-57b828ef364b3cce05d9fb35be758cb4530e0e12.tar.bz2
Also copy EI_OSABI field
bfd/ PR binutils/16318 * elf.c (_bfd_elf_copy_private_bfd_data): Remove BFD_ASSERT. Set e_flags only if elf_flags_init is FALSE. Copy EI_OSABI field. binutils/testsuite/ PR binutils/16318 * binutils-all/strip-10.d: Check OS/ABI.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf.c14
2 files changed, 16 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 09da41b..7e41ce8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
2013-12-12 H.J. Lu <hongjiu.lu@intel.com>
+ PR binutils/16318
+ * elf.c (_bfd_elf_copy_private_bfd_data): Remove BFD_ASSERT.
+ Set e_flags only if elf_flags_init is FALSE. Copy EI_OSABI
+ field.
+
+2013-12-12 H.J. Lu <hongjiu.lu@intel.com>
+
* elf32-sh.c (bfd_elf32_bfd_set_private_bfd_flags): Removed.
2013-12-12 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/bfd/elf.c b/bfd/elf.c
index 66d9644..30d4171 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1117,13 +1117,17 @@ _bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
- BFD_ASSERT (!elf_flags_init (obfd)
- || (elf_elfheader (obfd)->e_flags
- == elf_elfheader (ibfd)->e_flags));
+ if (!elf_flags_init (obfd))
+ {
+ elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
+ elf_flags_init (obfd) = TRUE;
+ }
elf_gp (obfd) = elf_gp (ibfd);
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = TRUE;
+
+ /* Also copy the EI_OSABI field. */
+ elf_elfheader (obfd)->e_ident[EI_OSABI] =
+ elf_elfheader (ibfd)->e_ident[EI_OSABI];
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);