/* BFD back-end for PowerPC Microsoft Portable Executable files.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
+ Copyright (C) 1990-2020 Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
ppc_coff_link_hash_table_create (bfd *abfd)
{
struct ppc_coff_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table);
+ size_t amt = sizeof (struct ppc_coff_link_hash_table);
ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
const char *name)
{
/* Add this entry to our toc addr-offset-name list. */
- bfd_size_type amt = sizeof (struct list_ele);
+ size_t amt = sizeof (struct list_ele);
struct list_ele *t = (struct list_ele *) bfd_malloc (amt);
if (t == NULL)
switch (r_type)
{
default:
- _bfd_error_handler
- /* xgettext: c-format */
- (_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type);
+ /* xgettext: c-format */
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ input_bfd, r_type);
bfd_set_error (bfd_error_bad_value);
return FALSE;
case IMAGE_REL_PPC_TOCREL16:
{
_bfd_error_handler
/* xgettext: c-format */
- (_("%B: Relocation for %s of %#Lx exceeds "
+ (_("%pB: Relocation for %s of %#" PRIx64 " exceeds "
"Toc size limit"),
- input_bfd, name, our_toc_offset);
+ input_bfd, name, (uint64_t) our_toc_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
{
_bfd_error_handler
/* xgettext: c-format */
- (_("%B: Relocation exceeds allocated TOC (%#Lx)"),
- input_bfd, toc_section->size);
+ (_("%pB: Relocation exceeds allocated TOC (%#" PRIx64 ")"),
+ input_bfd, (uint64_t) toc_section->size);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
_bfd_error_handler
/* xgettext: c-format */
- (_("Warning: unsupported reloc %s <file %B, section %A>\n"
- "sym %ld (%s), r_vaddr %Ld (%#Lx)"),
+ (_("warning: unsupported reloc %s <file %pB, section %pA>\n"
+ "sym %ld (%s), r_vaddr %" PRId64 " (%#" PRIx64 ")"),
howto->name, input_bfd, input_section,
- rel->r_symndx, my_name, rel->r_vaddr, rel->r_vaddr);
+ rel->r_symndx, my_name,
+ (int64_t) rel->r_vaddr, (uint64_t) rel->r_vaddr);
}
break;
case IMAGE_REL_PPC_IMGLUE:
_bfd_error_handler
/* xgettext: c-format */
- (_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name);
+ (_("%pB: Out of order IMGLUE reloc for %s"), input_bfd, my_name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
{
asection *s;
bfd_byte *foo;
- bfd_size_type amt;
static char test_char = '1';
if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
/* No toc section? Something is very wrong. */
abort ();
- amt = global_toc_size;
- foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
+ foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, global_toc_size);
memset(foo, test_char, (size_t) global_toc_size);
s->size = global_toc_size;
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
debug_merge_allocated = FALSE;
- if (flaginfo.internal_syms != NULL)
- {
- free (flaginfo.internal_syms);
- flaginfo.internal_syms = NULL;
- }
- if (flaginfo.sec_ptrs != NULL)
- {
- free (flaginfo.sec_ptrs);
- flaginfo.sec_ptrs = NULL;
- }
- if (flaginfo.sym_indices != NULL)
- {
- free (flaginfo.sym_indices);
- flaginfo.sym_indices = NULL;
- }
- if (flaginfo.linenos != NULL)
- {
- free (flaginfo.linenos);
- flaginfo.linenos = NULL;
- }
- if (flaginfo.contents != NULL)
- {
- free (flaginfo.contents);
- flaginfo.contents = NULL;
- }
- if (flaginfo.external_relocs != NULL)
- {
- free (flaginfo.external_relocs);
- flaginfo.external_relocs = NULL;
- }
- if (flaginfo.internal_relocs != NULL)
- {
- free (flaginfo.internal_relocs);
- flaginfo.internal_relocs = NULL;
- }
+ free (flaginfo.internal_syms);
+ flaginfo.internal_syms = NULL;
+ free (flaginfo.sec_ptrs);
+ flaginfo.sec_ptrs = NULL;
+ free (flaginfo.sym_indices);
+ flaginfo.sym_indices = NULL;
+ free (flaginfo.linenos);
+ flaginfo.linenos = NULL;
+ free (flaginfo.contents);
+ flaginfo.contents = NULL;
+ free (flaginfo.external_relocs);
+ flaginfo.external_relocs = NULL;
+ free (flaginfo.internal_relocs);
+ flaginfo.internal_relocs = NULL;
/* The value of the last C_FILE symbol is supposed to be the symbol
index of the first external symbol. Write it out again if
goto error_return;
/* The outsyms buffer is used by _bfd_coff_write_global_sym. */
- if (flaginfo.outsyms != NULL)
- {
- free (flaginfo.outsyms);
- flaginfo.outsyms = NULL;
- }
+ free (flaginfo.outsyms);
+ flaginfo.outsyms = NULL;
if (bfd_link_relocatable (info))
{
for (i = 0; i < abfd->section_count; i++)
{
- if (flaginfo.section_info[i].relocs != NULL)
- free (flaginfo.section_info[i].relocs);
- if (flaginfo.section_info[i].rel_hashes != NULL)
- free (flaginfo.section_info[i].rel_hashes);
+ free (flaginfo.section_info[i].relocs);
+ free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
flaginfo.section_info = NULL;
_bfd_stringtab_free (flaginfo.strtab);
- /* Setting bfd_get_symcount to 0 will cause write_object_contents to
+ /* Setting symcount to 0 will cause write_object_contents to
not try to write out the symbols. */
- bfd_get_symcount (abfd) = 0;
+ abfd->symcount = 0;
return TRUE;
for (i = 0; i < abfd->section_count; i++)
{
- if (flaginfo.section_info[i].relocs != NULL)
- free (flaginfo.section_info[i].relocs);
- if (flaginfo.section_info[i].rel_hashes != NULL)
- free (flaginfo.section_info[i].rel_hashes);
+ free (flaginfo.section_info[i].relocs);
+ free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
}
- if (flaginfo.internal_syms != NULL)
- free (flaginfo.internal_syms);
- if (flaginfo.sec_ptrs != NULL)
- free (flaginfo.sec_ptrs);
- if (flaginfo.sym_indices != NULL)
- free (flaginfo.sym_indices);
- if (flaginfo.outsyms != NULL)
- free (flaginfo.outsyms);
- if (flaginfo.linenos != NULL)
- free (flaginfo.linenos);
- if (flaginfo.contents != NULL)
- free (flaginfo.contents);
- if (flaginfo.external_relocs != NULL)
- free (flaginfo.external_relocs);
- if (flaginfo.internal_relocs != NULL)
- free (flaginfo.internal_relocs);
- if (external_relocs != NULL)
- free (external_relocs);
+ free (flaginfo.internal_syms);
+ free (flaginfo.sec_ptrs);
+ free (flaginfo.sym_indices);
+ free (flaginfo.outsyms);
+ free (flaginfo.linenos);
+ free (flaginfo.contents);
+ free (flaginfo.external_relocs);
+ free (flaginfo.internal_relocs);
+ free (external_relocs);
return FALSE;
}
#endif