mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-22 07:53:36 +08:00
* elf64-ppc.c (ppc_stub_name): Return immediately on bfd_malloc fail.
(ppc64_elf_edit_opd): Ignore zero size .opd. Check bfd_alloc return value.
This commit is contained in:
parent
b4f4e59fff
commit
46de2a7c48
@ -4,6 +4,8 @@
|
|||||||
case, include addend when indexing .opd section map.
|
case, include addend when indexing .opd section map.
|
||||||
(ppc64_elf_edit_opd): Add no_opd_opt param. Do nothing besides
|
(ppc64_elf_edit_opd): Add no_opd_opt param. Do nothing besides
|
||||||
clear opd_adjust array if no_opd_opt set. Tidy code.
|
clear opd_adjust array if no_opd_opt set. Tidy code.
|
||||||
|
Ignore zero size .opd. Check bfd_alloc return value.
|
||||||
|
(ppc_stub_name): Return immediately on bfd_malloc fail.
|
||||||
* elf64-ppc.h (ppc64_elf_edit_opd): Update prototype.
|
* elf64-ppc.h (ppc64_elf_edit_opd): Update prototype.
|
||||||
|
|
||||||
2005-06-04 H.J. Lu <hongjiu.lu@intel.com>
|
2005-06-04 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
@ -3581,27 +3581,27 @@ ppc_stub_name (const asection *input_section,
|
|||||||
{
|
{
|
||||||
len = 8 + 1 + strlen (h->elf.root.root.string) + 1 + 8 + 1;
|
len = 8 + 1 + strlen (h->elf.root.root.string) + 1 + 8 + 1;
|
||||||
stub_name = bfd_malloc (len);
|
stub_name = bfd_malloc (len);
|
||||||
if (stub_name != NULL)
|
if (stub_name == NULL)
|
||||||
{
|
return stub_name;
|
||||||
|
|
||||||
sprintf (stub_name, "%08x.%s+%x",
|
sprintf (stub_name, "%08x.%s+%x",
|
||||||
input_section->id & 0xffffffff,
|
input_section->id & 0xffffffff,
|
||||||
h->elf.root.root.string,
|
h->elf.root.root.string,
|
||||||
(int) rel->r_addend & 0xffffffff);
|
(int) rel->r_addend & 0xffffffff);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
|
len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
|
||||||
stub_name = bfd_malloc (len);
|
stub_name = bfd_malloc (len);
|
||||||
if (stub_name != NULL)
|
if (stub_name == NULL)
|
||||||
{
|
return stub_name;
|
||||||
|
|
||||||
sprintf (stub_name, "%08x.%x:%x+%x",
|
sprintf (stub_name, "%08x.%x:%x+%x",
|
||||||
input_section->id & 0xffffffff,
|
input_section->id & 0xffffffff,
|
||||||
sym_sec->id & 0xffffffff,
|
sym_sec->id & 0xffffffff,
|
||||||
(int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
|
(int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
|
||||||
(int) rel->r_addend & 0xffffffff);
|
(int) rel->r_addend & 0xffffffff);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
|
if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
|
||||||
stub_name[len - 2] = 0;
|
stub_name[len - 2] = 0;
|
||||||
return stub_name;
|
return stub_name;
|
||||||
@ -6176,7 +6176,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
|
|||||||
bfd_size_type cnt_16b = 0;
|
bfd_size_type cnt_16b = 0;
|
||||||
|
|
||||||
sec = bfd_get_section_by_name (ibfd, ".opd");
|
sec = bfd_get_section_by_name (ibfd, ".opd");
|
||||||
if (sec == NULL)
|
if (sec == NULL || sec->size == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
amt = sec->size * sizeof (long) / 8;
|
amt = sec->size * sizeof (long) / 8;
|
||||||
@ -6186,6 +6186,8 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
|
|||||||
/* check_relocs hasn't been called. Must be a ld -r link
|
/* check_relocs hasn't been called. Must be a ld -r link
|
||||||
or --just-symbols object. */
|
or --just-symbols object. */
|
||||||
opd_adjust = bfd_alloc (obfd, amt);
|
opd_adjust = bfd_alloc (obfd, amt);
|
||||||
|
if (opd_adjust == NULL)
|
||||||
|
return FALSE;
|
||||||
ppc64_elf_section_data (sec)->opd.adjust = opd_adjust;
|
ppc64_elf_section_data (sec)->opd.adjust = opd_adjust;
|
||||||
}
|
}
|
||||||
memset (opd_adjust, 0, amt);
|
memset (opd_adjust, 0, amt);
|
||||||
|
Loading…
Reference in New Issue
Block a user