aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2004-05-17 16:40:01 +0000
committerBob Wilson <bob.wilson@acm.org>2004-05-17 16:40:01 +0000
commit80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d (patch)
tree37e972e1e55e1a0d2b94dd6198e53f0567008a27 /bfd/elf.c
parentcea96d64fe6299c4fd45291fe7ccc49215363322 (diff)
downloadgdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.zip
gdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.tar.gz
gdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.tar.bz2
binutils ChangeLog:
2004-05-17 David Heine <dlheine@tensilica.com> * objcopy.c (setup_bfd_headers): New function. (copy_object): Call setup_bfd_headers. bfd ChangeLog: 2004-05-17 David Heine <dlheine@tensilica.com> * aout-target.h (MY_bfd_copy_private_header_data): Define. * aout-tic30.c (MY_bfd_copy_private_header_data): Define. * bfd.c (bfd_copy_private_header_data): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add entries for new interface. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_copy_private_header_data): Define. * elf-bfd.h (_bfd_elf_copy_private_header_data): Declare. * elf.c (_bfd_elf_copy_private_section_data): Remove code to set up segments by calling copy_private_bfd_data. (_bfd_elf_copy_private_header_data): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_private_header_data): Define. * libbfd-in.h (_bfd_generic_bfd_copy_private_header_data): Define. * libecoff.h (_bfd_ecoff_bfd_copy_private_header_data): Define. * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Define. * mmo.c (mmo_bfd_copy_private_header_data): Define. * ppcboot.c (ppcboot_bfd_copy_private_header_data): Define. * som.c (som_bfd_copy_private_header_data): Define. * targets.c (BFD_JUMP_TABLE_COPY): Add _bfd_copy_private_header_data. * vms.c (vms_bfd_copy_private_header_data): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 8e208c2..0317e35 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5290,24 +5290,6 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
- if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
- {
- asection *s;
-
- /* Only set up the segments if there are no more SEC_ALLOC
- sections. FIXME: This won't do the right thing if objcopy is
- used to remove the last SEC_ALLOC section, since objcopy
- won't call this routine in that case. */
- for (s = isec->next; s != NULL; s = s->next)
- if ((s->flags & SEC_ALLOC) != 0)
- break;
- if (s == NULL)
- {
- if (! copy_private_bfd_data (ibfd, obfd))
- return FALSE;
- }
- }
-
ihdr = &elf_section_data (isec)->this_hdr;
ohdr = &elf_section_data (osec)->this_hdr;
@@ -5330,6 +5312,29 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
return TRUE;
}
+/* Copy private header information. */
+
+bfd_boolean
+_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
+{
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ /* Copy over private BFD data if it has not already been copied.
+ This must be done here, rather than in the copy_private_bfd_data
+ entry point, because the latter is called after the section
+ contents have been set, which means that the program headers have
+ already been worked out. */
+ if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
+ {
+ if (! copy_private_bfd_data (ibfd, obfd))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Copy private symbol information. If this symbol is in a section
which we did not map into a BFD section, try to map the section
index correctly. We use special macro definitions for the mapped