mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
PR ld/2754
* elf.c (bfd_elf_mkobject): Don't alloc if already done. Set program_header_size to -1. (_bfd_elf_map_sections_to_segments): Adjust program_header_size check. (assign_file_positions_for_load_sections ): Likewise. (_bfd_elf_sizeof_headers): Use saved program_header_size if available. * elf32-arm.c (elf32_arm_mkobject): Call bfd_elf_mkobject, don't alloc if already done. * elf32-i386.c (elf_i386_mkobject): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Likewise. * elf32-s390.c (elf_s390_mkobject): Likewise. * elf32-sh.c (sh_elf_mkobject): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Likewise. * elf64-s390.c (elf_s390_mkobject): Likewise. * elf64-x86-64.c (elf64_x86_64_mkobject): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Likewise.
This commit is contained in:
parent
8c2afc38d8
commit
62d7a5f67e
@ -1,3 +1,24 @@
|
||||
2006-06-23 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
PR ld/2754
|
||||
* elf.c (bfd_elf_mkobject): Don't alloc if already done. Set
|
||||
program_header_size to -1.
|
||||
(_bfd_elf_map_sections_to_segments): Adjust program_header_size check.
|
||||
(assign_file_positions_for_load_sections ): Likewise.
|
||||
(_bfd_elf_sizeof_headers): Use saved program_header_size if
|
||||
available.
|
||||
* elf32-arm.c (elf32_arm_mkobject): Call bfd_elf_mkobject, don't
|
||||
alloc if already done.
|
||||
* elf32-i386.c (elf_i386_mkobject): Likewise.
|
||||
* elf32-ppc.c (ppc_elf_mkobject): Likewise.
|
||||
* elf32-s390.c (elf_s390_mkobject): Likewise.
|
||||
* elf32-sh.c (sh_elf_mkobject): Likewise.
|
||||
* elf64-alpha.c (elf64_alpha_mkobject): Likewise.
|
||||
* elf64-ppc.c (ppc64_elf_mkobject): Likewise.
|
||||
* elf64-s390.c (elf_s390_mkobject): Likewise.
|
||||
* elf64-x86-64.c (elf64_x86_64_mkobject): Likewise.
|
||||
* elfxx-sparc.c (_bfd_sparc_elf_mkobject): Likewise.
|
||||
|
||||
2006-06-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* elflink.c (elf_link_add_object_symbols): Don't create .tcommon
|
||||
|
36
bfd/elf.c
36
bfd/elf.c
@ -209,13 +209,14 @@ bfd_elf_hash (const char *namearg)
|
||||
bfd_boolean
|
||||
bfd_elf_mkobject (bfd *abfd)
|
||||
{
|
||||
/* This just does initialization. */
|
||||
/* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
|
||||
elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
||||
if (elf_tdata (abfd) == 0)
|
||||
return FALSE;
|
||||
/* Since everything is done at close time, do we need any
|
||||
initialization? */
|
||||
if (abfd->tdata.any == NULL)
|
||||
{
|
||||
abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
elf_tdata (abfd)->program_header_size = (bfd_size_type) -1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -3852,7 +3853,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
|
||||
|
||||
if (phdr_size == 0)
|
||||
if (phdr_size == (bfd_size_type) -1)
|
||||
phdr_size = get_program_header_size (abfd, info);
|
||||
if ((abfd->flags & D_PAGED) == 0
|
||||
|| sections[0]->lma < phdr_size
|
||||
@ -4227,7 +4228,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
|
||||
elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr;
|
||||
elf_elfheader (abfd)->e_phnum = alloc;
|
||||
|
||||
if (elf_tdata (abfd)->program_header_size == 0)
|
||||
if (elf_tdata (abfd)->program_header_size == (bfd_size_type) -1)
|
||||
elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr;
|
||||
else
|
||||
BFD_ASSERT (elf_tdata (abfd)->program_header_size
|
||||
@ -7063,14 +7064,19 @@ _bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
|
||||
|
||||
if (!info->relocatable)
|
||||
{
|
||||
struct elf_segment_map *m;
|
||||
bfd_size_type phdr_size = 0;
|
||||
bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
|
||||
|
||||
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
|
||||
phdr_size += bed->s->sizeof_phdr;
|
||||
if (phdr_size == (bfd_size_type) -1)
|
||||
{
|
||||
struct elf_segment_map *m;
|
||||
|
||||
if (phdr_size == 0)
|
||||
phdr_size = get_program_header_size (abfd, info);
|
||||
phdr_size = 0;
|
||||
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
|
||||
phdr_size += bed->s->sizeof_phdr;
|
||||
|
||||
if (phdr_size == 0)
|
||||
phdr_size = get_program_header_size (abfd, info);
|
||||
}
|
||||
|
||||
elf_tdata (abfd)->program_header_size = phdr_size;
|
||||
ret += phdr_size;
|
||||
|
@ -2038,11 +2038,14 @@ struct elf32_arm_obj_tdata
|
||||
static bfd_boolean
|
||||
elf32_arm_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
/* The ARM linker needs to keep track of the number of relocs that it
|
||||
|
@ -626,11 +626,14 @@ struct elf_i386_obj_tdata
|
||||
static bfd_boolean
|
||||
elf_i386_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
/* i386 ELF linker hash table. */
|
||||
|
@ -1708,11 +1708,14 @@ struct ppc_elf_obj_tdata
|
||||
static bfd_boolean
|
||||
ppc_elf_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
/* Fix bad default arch selected for a 32 bit input bfd when the
|
||||
|
@ -73,8 +73,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class
|
||||
PARAMS ((const Elf_Internal_Rela *));
|
||||
static bfd_boolean elf_s390_finish_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
static bfd_boolean elf_s390_mkobject
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean elf_s390_object_p
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean elf_s390_grok_prstatus
|
||||
@ -678,14 +676,16 @@ struct elf_s390_obj_tdata
|
||||
(elf_s390_tdata (abfd)->local_got_tls_type)
|
||||
|
||||
static bfd_boolean
|
||||
elf_s390_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
elf_s390_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
@ -3518,11 +3518,14 @@ struct sh_elf_obj_tdata
|
||||
static bfd_boolean
|
||||
sh_elf_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
/* sh ELF linker hash table. */
|
||||
|
@ -321,11 +321,14 @@ struct alpha_elf_obj_tdata
|
||||
static bfd_boolean
|
||||
elf64_alpha_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
@ -2408,11 +2408,14 @@ struct ppc64_elf_obj_tdata
|
||||
static bfd_boolean
|
||||
ppc64_elf_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
/* Return 1 if target is one of ours. */
|
||||
|
@ -73,8 +73,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class
|
||||
PARAMS ((const Elf_Internal_Rela *));
|
||||
static bfd_boolean elf_s390_finish_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
static bfd_boolean elf_s390_mkobject
|
||||
PARAMS ((bfd *));
|
||||
static bfd_boolean elf_s390_object_p
|
||||
PARAMS ((bfd *));
|
||||
static int elf_s390_tls_transition
|
||||
@ -631,14 +629,16 @@ struct elf_s390_obj_tdata
|
||||
(elf_s390_tdata (abfd)->local_got_tls_type)
|
||||
|
||||
static bfd_boolean
|
||||
elf_s390_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
elf_s390_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
@ -676,11 +676,14 @@ elf64_x86_64_copy_indirect_symbol (struct bfd_link_info *info,
|
||||
static bfd_boolean
|
||||
elf64_x86_64_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
@ -487,11 +487,14 @@ struct _bfd_sparc_elf_obj_tdata
|
||||
bfd_boolean
|
||||
_bfd_sparc_elf_mkobject (bfd *abfd)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata);
|
||||
abfd->tdata.any = bfd_zalloc (abfd, amt);
|
||||
if (abfd->tdata.any == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
return bfd_elf_mkobject (abfd);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user