forked from Imagelibrary/binutils-gdb
* elf-hppa.h (elf_hppa_final_link): Use gp val of zero when none
of the usual sections are found. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Tidy. Strip .dynbss if it is zero size. * elf32-arm.c (elf32_arm_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise, and .dynsbss. (i370_elf_finish_dynamic_sections): Don't attempt to write .got when it is zero size. * elf32-i386.c (elf_i386_size_dynamic_sections): Correct handling of .dynbss and zero size sections. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Strip .dynbss if it is zero size. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise, .dynsbss too. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Tidy. Strip .plt.* and .got.plt.* if zero size. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Tidy. Strip .got* and .dynbss if zero size. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Tidy. Strip * elf64-ppc.c (create_linkage_sections): Create branch lookup table in .data.rel.ro.brlt or .rodata.brlt, and similarly for associated reloc section. (create_got_section): Always create new .got and .rela.got sections. (ppc64_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Handle dynamic bss sections correctly. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Tidy. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size.
This commit is contained in:
@@ -1699,7 +1699,6 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
|
||||
for (s = dynobj->sections; s != NULL; s = s->next)
|
||||
{
|
||||
const char *name;
|
||||
bfd_boolean strip;
|
||||
|
||||
if ((s->flags & SEC_LINKER_CREATED) == 0)
|
||||
continue;
|
||||
@@ -1708,60 +1707,21 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
|
||||
of the dynobj section names depend upon the input files. */
|
||||
name = bfd_get_section_name (dynobj, s);
|
||||
|
||||
strip = 0;
|
||||
|
||||
if (strcmp (name, ".plt") == 0)
|
||||
{
|
||||
/* Strip this section if we don't need it; see the comment below. */
|
||||
if (s->size == 0)
|
||||
{
|
||||
strip = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remember whether there is a PLT. */
|
||||
plt = TRUE;
|
||||
}
|
||||
/* Remember whether there is a PLT. */
|
||||
plt = s->size != 0;
|
||||
}
|
||||
else if (strcmp (name, ".dlt") == 0)
|
||||
else if (strcmp (name, ".opd") == 0
|
||||
|| strncmp (name, ".dlt", 4) == 0
|
||||
|| strcmp (name, ".stub") == 0
|
||||
|| strcmp (name, ".got") == 0)
|
||||
{
|
||||
/* Strip this section if we don't need it; see the comment below. */
|
||||
if (s->size == 0)
|
||||
{
|
||||
strip = TRUE;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, ".opd") == 0)
|
||||
{
|
||||
/* Strip this section if we don't need it; see the comment below. */
|
||||
if (s->size == 0)
|
||||
{
|
||||
strip = TRUE;
|
||||
}
|
||||
}
|
||||
else if (strncmp (name, ".rela", 5) == 0)
|
||||
{
|
||||
/* If we don't need this section, strip it from the output file.
|
||||
This is mostly to handle .rela.bss and .rela.plt. We must
|
||||
create both sections in create_dynamic_sections, because they
|
||||
must be created before the linker maps input sections to output
|
||||
sections. The linker does that before adjust_dynamic_symbol
|
||||
is called, and it is that function which decides whether
|
||||
anything needs to go into these sections. */
|
||||
if (s->size == 0)
|
||||
{
|
||||
/* If we don't need this section, strip it from the
|
||||
output file. This is mostly to handle .rela.bss and
|
||||
.rela.plt. We must create both sections in
|
||||
create_dynamic_sections, because they must be created
|
||||
before the linker maps input sections to output
|
||||
sections. The linker does that before
|
||||
adjust_dynamic_symbol is called, and it is that
|
||||
function which decides whether anything needs to go
|
||||
into these sections. */
|
||||
strip = TRUE;
|
||||
}
|
||||
else
|
||||
if (s->size != 0)
|
||||
{
|
||||
asection *target;
|
||||
|
||||
@@ -1792,20 +1752,30 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
|
||||
s->reloc_count = 0;
|
||||
}
|
||||
}
|
||||
else if (strncmp (name, ".dlt", 4) != 0
|
||||
&& strcmp (name, ".stub") != 0
|
||||
&& strcmp (name, ".got") != 0)
|
||||
else
|
||||
{
|
||||
/* It's not one of our sections, so don't allocate space. */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strip)
|
||||
if (s->size == 0)
|
||||
{
|
||||
/* If we don't need this section, strip it from the
|
||||
output file. This is mostly to handle .rela.bss and
|
||||
.rela.plt. We must create both sections in
|
||||
create_dynamic_sections, because they must be created
|
||||
before the linker maps input sections to output
|
||||
sections. The linker does that before
|
||||
adjust_dynamic_symbol is called, and it is that
|
||||
function which decides whether anything needs to go
|
||||
into these sections. */
|
||||
s->flags |= SEC_EXCLUDE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((s->flags & SEC_HAS_CONTENTS) == 0)
|
||||
continue;
|
||||
|
||||
/* Allocate memory for the section contents if it has not
|
||||
been allocated already. We use bfd_zalloc here in case
|
||||
unused entries are not reclaimed before the section's
|
||||
@@ -1815,7 +1785,7 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
|
||||
if (s->contents == NULL)
|
||||
{
|
||||
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
|
||||
if (s->contents == NULL && s->size != 0)
|
||||
if (s->contents == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user