bfd/
* elf64-ppc.c (ppc64_elf_edit_toc): Skip toc if size is zero. Skip toc reloc adjust if reloc_count is zero. ld/ * emultempl/ppc64elf.em (ppc_create_output_section_statements): Make an error creating fake bfd fatal. (ppc_before_allocation): Continue on after errors. (gld${EMULATION_NAME}_finish): Likewise.
This commit is contained in:
parent
55e5a6d086
commit
92b7a70fca
|
@ -1,3 +1,8 @@
|
||||||
|
2005-02-16 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf64-ppc.c (ppc64_elf_edit_toc): Skip toc if size is zero.
|
||||||
|
Skip toc reloc adjust if reloc_count is zero.
|
||||||
|
|
||||||
2005-02-15 Nigel Stephens <nigel@mips.com>
|
2005-02-15 Nigel Stephens <nigel@mips.com>
|
||||||
Maciej W. Rozycki <macro@mips.com>
|
Maciej W. Rozycki <macro@mips.com>
|
||||||
|
|
||||||
|
|
|
@ -6782,13 +6782,14 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
||||||
Elf_Internal_Shdr *symtab_hdr;
|
Elf_Internal_Shdr *symtab_hdr;
|
||||||
Elf_Internal_Sym *local_syms;
|
Elf_Internal_Sym *local_syms;
|
||||||
struct elf_link_hash_entry **sym_hashes;
|
struct elf_link_hash_entry **sym_hashes;
|
||||||
Elf_Internal_Rela *relstart, *rel, *wrel;
|
Elf_Internal_Rela *relstart, *rel;
|
||||||
unsigned long *skip, *drop;
|
unsigned long *skip, *drop;
|
||||||
unsigned char *used;
|
unsigned char *used;
|
||||||
unsigned char *keep, last, some_unused;
|
unsigned char *keep, last, some_unused;
|
||||||
|
|
||||||
toc = bfd_get_section_by_name (ibfd, ".toc");
|
toc = bfd_get_section_by_name (ibfd, ".toc");
|
||||||
if (toc == NULL
|
if (toc == NULL
|
||||||
|
|| toc->size == 0
|
||||||
|| toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS
|
|| toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS
|
||||||
|| elf_discarded_section (toc))
|
|| elf_discarded_section (toc))
|
||||||
continue;
|
continue;
|
||||||
|
@ -7033,8 +7034,14 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
||||||
toc->rawsize = toc->size;
|
toc->rawsize = toc->size;
|
||||||
toc->size = src - contents - off;
|
toc->size = src - contents - off;
|
||||||
|
|
||||||
|
if (toc->reloc_count != 0)
|
||||||
|
{
|
||||||
|
Elf_Internal_Rela *wrel;
|
||||||
|
bfd_size_type sz;
|
||||||
|
|
||||||
/* Read toc relocs. */
|
/* Read toc relocs. */
|
||||||
relstart = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL, TRUE);
|
relstart = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL,
|
||||||
|
TRUE);
|
||||||
if (relstart == NULL)
|
if (relstart == NULL)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
|
|
||||||
|
@ -7049,9 +7056,10 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
||||||
++wrel;
|
++wrel;
|
||||||
}
|
}
|
||||||
toc->reloc_count = wrel - relstart;
|
toc->reloc_count = wrel - relstart;
|
||||||
elf_section_data (toc)->rel_hdr.sh_size
|
sz = elf_section_data (toc)->rel_hdr.sh_entsize;
|
||||||
= toc->reloc_count * elf_section_data (toc)->rel_hdr.sh_entsize;
|
elf_section_data (toc)->rel_hdr.sh_size = toc->reloc_count * sz;
|
||||||
BFD_ASSERT (elf_section_data (toc)->rel_hdr2 == NULL);
|
BFD_ASSERT (elf_section_data (toc)->rel_hdr2 == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Adjust addends for relocs against the toc section sym. */
|
/* Adjust addends for relocs against the toc section sym. */
|
||||||
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
|
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2005-02-16 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* emultempl/ppc64elf.em (ppc_create_output_section_statements): Make
|
||||||
|
an error creating fake bfd fatal.
|
||||||
|
(ppc_before_allocation): Continue on after errors.
|
||||||
|
(gld${EMULATION_NAME}_finish): Likewise.
|
||||||
|
|
||||||
2005-02-15 Nick Clifton <nickc@redhat.com>
|
2005-02-15 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* ldlex.l (YY_NO_UNPUT): Define so that the yy_unput function is
|
* ldlex.l (YY_NO_UNPUT): Define so that the yy_unput function is
|
||||||
|
|
|
@ -88,7 +88,7 @@ ppc_create_output_section_statements (void)
|
||||||
bfd_get_arch (output_bfd),
|
bfd_get_arch (output_bfd),
|
||||||
bfd_get_mach (output_bfd)))
|
bfd_get_mach (output_bfd)))
|
||||||
{
|
{
|
||||||
einfo ("%X%P: can not create BFD %E\n");
|
einfo ("%F%P: can not create BFD %E\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +104,7 @@ ppc_before_allocation (void)
|
||||||
{
|
{
|
||||||
if (!no_opd_opt
|
if (!no_opd_opt
|
||||||
&& !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd))
|
&& !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd))
|
||||||
{
|
|
||||||
einfo ("%X%P: can not edit %s %E\n", "opd");
|
einfo ("%X%P: can not edit %s %E\n", "opd");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt)
|
if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt)
|
||||||
{
|
{
|
||||||
|
@ -117,10 +114,7 @@ ppc_before_allocation (void)
|
||||||
&stat_ptr->head, 0, 0, NULL, TRUE);
|
&stat_ptr->head, 0, 0, NULL, TRUE);
|
||||||
|
|
||||||
if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
|
if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
|
||||||
{
|
|
||||||
einfo ("%X%P: TLS problem %E\n");
|
einfo ("%X%P: TLS problem %E\n");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We must not cache anything from the preliminary sizing. */
|
/* We must not cache anything from the preliminary sizing. */
|
||||||
elf_tdata (output_bfd)->program_header_size = 0;
|
elf_tdata (output_bfd)->program_header_size = 0;
|
||||||
|
@ -130,10 +124,7 @@ ppc_before_allocation (void)
|
||||||
if (!no_toc_opt
|
if (!no_toc_opt
|
||||||
&& !link_info.relocatable
|
&& !link_info.relocatable
|
||||||
&& !ppc64_elf_edit_toc (output_bfd, &link_info))
|
&& !ppc64_elf_edit_toc (output_bfd, &link_info))
|
||||||
{
|
|
||||||
einfo ("%X%P: can not edit %s %E\n", "toc");
|
einfo ("%X%P: can not edit %s %E\n", "toc");
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gld${EMULATION_NAME}_before_allocation ();
|
gld${EMULATION_NAME}_before_allocation ();
|
||||||
|
@ -343,14 +334,10 @@ gld${EMULATION_NAME}_finish (void)
|
||||||
{
|
{
|
||||||
int ret = ppc64_elf_setup_section_lists (output_bfd, &link_info,
|
int ret = ppc64_elf_setup_section_lists (output_bfd, &link_info,
|
||||||
no_multi_toc);
|
no_multi_toc);
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
|
||||||
einfo ("%X%P: can not size stub section: %E\n");
|
einfo ("%X%P: can not size stub section: %E\n");
|
||||||
return;
|
else if (ret > 0)
|
||||||
}
|
{
|
||||||
|
|
||||||
toc_section = bfd_get_section_by_name (output_bfd, ".got");
|
toc_section = bfd_get_section_by_name (output_bfd, ".got");
|
||||||
if (toc_section != NULL)
|
if (toc_section != NULL)
|
||||||
lang_for_each_statement (build_toc_list);
|
lang_for_each_statement (build_toc_list);
|
||||||
|
@ -365,10 +352,7 @@ gld${EMULATION_NAME}_finish (void)
|
||||||
group_size,
|
group_size,
|
||||||
&ppc_add_stub_section,
|
&ppc_add_stub_section,
|
||||||
&ppc_layout_sections_again))
|
&ppc_layout_sections_again))
|
||||||
{
|
|
||||||
einfo ("%X%P: can not size stub section: %E\n");
|
einfo ("%X%P: can not size stub section: %E\n");
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue