BFD_ASSERT (g->howto != NULL);
- if (bfd_get_reloc_size (g->howto) != 8)
- r_length = g->howto->size; /* Size as a power of two. */
- else
- r_length = 3;
+ switch (bfd_get_reloc_size (g->howto))
+ {
+ default:
+ _bfd_error_handler (_("%pB: unsupported AOUT relocation size: %d"),
+ abfd, bfd_get_reloc_size (g->howto));
+ bfd_set_error (bfd_error_bad_value);
+ return;
+ case 1:
+ case 2:
+ case 4:
+ r_length = g->howto->size; /* Size as a power of two. */
+ break;
+ case 8:
+ r_length = 3;
+ break;
+ }
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
/* XXX This relies on relocs coming from a.out files. */
bfd_size_type filelen, funclen;
char *buf;
- *filename_ptr = abfd->filename;
+ *filename_ptr = bfd_get_filename (abfd);
*functionname_ptr = NULL;
*line_ptr = 0;
if (disriminator_ptr)
else
funclen = strlen (bfd_asymbol_name (func));
- if (adata (abfd).line_buf != NULL)
- free (adata (abfd).line_buf);
+ free (adata (abfd).line_buf);
if (filelen + funclen == 0)
adata (abfd).line_buf = buf = NULL;
|| abfd->tdata.aout_data == NULL)
return TRUE;
-#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
+#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (obj_aout_symbols (abfd));
#ifdef USE_MMAP
obj_aout_external_syms (abfd) = 0;
discarding such symbols. */
if (strip != strip_all
&& (strip != strip_some
- || bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
+ || bfd_hash_lookup (flaginfo->info->keep_hash,
+ bfd_get_filename (input_bfd),
FALSE, FALSE) != NULL)
&& discard != discard_all)
{
H_PUT_8 (output_bfd, 0, outsym->e_other);
H_PUT_16 (output_bfd, 0, outsym->e_desc);
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
- input_bfd->filename, FALSE);
+ bfd_get_filename (input_bfd), FALSE);
if (strtab_index == (bfd_size_type) -1)
return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
}
}
- if (aout_info.contents != NULL)
- {
- free (aout_info.contents);
- aout_info.contents = NULL;
- }
- if (aout_info.relocs != NULL)
- {
- free (aout_info.relocs);
- aout_info.relocs = NULL;
- }
- if (aout_info.symbol_map != NULL)
- {
- free (aout_info.symbol_map);
- aout_info.symbol_map = NULL;
- }
- if (aout_info.output_syms != NULL)
- {
- free (aout_info.output_syms);
- aout_info.output_syms = NULL;
- }
+ free (aout_info.contents);
+ aout_info.contents = NULL;
+ free (aout_info.relocs);
+ aout_info.relocs = NULL;
+ free (aout_info.symbol_map);
+ aout_info.symbol_map = NULL;
+ free (aout_info.output_syms);
+ aout_info.output_syms = NULL;
+
if (includes_hash_initialized)
{
bfd_hash_table_free (&aout_info.includes.root);
return TRUE;
error_return:
- if (aout_info.contents != NULL)
- free (aout_info.contents);
- if (aout_info.relocs != NULL)
- free (aout_info.relocs);
- if (aout_info.symbol_map != NULL)
- free (aout_info.symbol_map);
- if (aout_info.output_syms != NULL)
- free (aout_info.output_syms);
+ free (aout_info.contents);
+ free (aout_info.relocs);
+ free (aout_info.symbol_map);
+ free (aout_info.output_syms);
if (includes_hash_initialized)
bfd_hash_table_free (&aout_info.includes.root);
return FALSE;