final_type = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types || !final_type)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types[0])
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (field == e_tsel)
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types[0])
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
*final_types[0] = R_S_MODE;
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types[0])
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
*final_types[0] = R_N_MODE;
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types[0])
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
*final_types[0] = R_D_MODE;
final_types[0] = (int *) bfd_alloc_by_size_t (abfd, sizeof (int));
if (!final_types[0])
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
*final_types[0] = R_R_MODE;
newname = bfd_alloc (abfd, strlen (sect->name) + 1);
if (!newname)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
strcpy (newname, sect->name);
if (bfd_read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return 0;
}
if (!_PA_RISC_ID (file_hdr.system_id))
{
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
#endif
break;
default:
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
if (file_hdr.version_id != VERSION_ID
&& file_hdr.version_id != NEW_VERSION_ID)
{
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
{
if (bfd_read ((PTR) & aux_hdr, 1, AUX_HDR_SIZE, abfd) != AUX_HDR_SIZE)
{
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
}
if (!setup_sections (abfd, &file_hdr))
{
/* setup_sections does not bubble up a bfd error code. */
- bfd_error = bad_value;
+ bfd_set_error (bfd_error_bad_value);
return 0;
}
bfd_zalloc (abfd, sizeof (struct som_data_struct));
if (abfd->tdata.som_data == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
obj_som_file_hdr (abfd)
if (obj_som_file_hdr (abfd) == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
return true;
stream. */
if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) != 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)
!= p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
p = tmp_space;
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)
!= p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
p = tmp_space;
them out. */
if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)
!= p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Reset to beginning of the buffer space. */
contained in a partial block. */
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd) != p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
*string_sizep = strings_size;
them out. */
if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)
!= p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Reset to beginning of the buffer space. */
/* Scribble out any partial block. */
if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd) != p - tmp_space)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
current_offset += len;
if (bfd_write ((PTR) obj_som_version_hdr (abfd), len, 1, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) obj_som_version_hdr (abfd)->user_string,
len, 1, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
}
current_offset += len;
if (bfd_write ((PTR) obj_som_copyright_hdr (abfd), len, 1, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) obj_som_copyright_hdr (abfd)->copyright,
len, 1, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
}
sizeof (struct subspace_dictionary_record), 1, abfd)
!= sizeof (struct subspace_dictionary_record))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
}
sizeof (struct subspace_dictionary_record), 1, abfd)
!= sizeof (struct subspace_dictionary_record))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
}
sizeof (struct space_dictionary_record), 1, abfd)
!= sizeof (struct space_dictionary_record))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
sizeof (struct header), 1, abfd)
!= sizeof (struct header))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
return true;
scribble out the symbol table. */
if (bfd_seek (abfd, symtab_location, SEEK_SET) != 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) som_symtab, symtab_size, 1, abfd) != symtab_size)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
return true;
stringtab = bfd_zalloc (abfd, obj_som_stringtab_size (abfd));
if (stringtab == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd)
!= obj_som_stringtab_size (abfd))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
bfd_zalloc (abfd, symbol_count * sizeof (som_symbol_type));
if (symbase == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
buf = alloca (symbol_count * symsize);
if (buf == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read (buf, symbol_count * symsize, 1, abfd)
!= symbol_count * symsize)
{
- bfd_error = no_symbols;
+ bfd_set_error (bfd_error_no_symbols);
return (false);
}
(som_symbol_type *) bfd_zalloc (abfd, sizeof (som_symbol_type));
if (new == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return 0;
}
new->symbol.the_bfd = abfd;
external_relocs = (char *) bfd_zalloc (abfd, fixup_stream_size);
if (external_relocs == (char *) NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
/* Read in the external forms. */
SEEK_SET)
!= 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read (external_relocs, 1, fixup_stream_size, abfd)
!= fixup_stream_size)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Let callers know how many relocations found.
num_relocs * sizeof (arelent));
if (internal_relocs == (arelent *) NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
(PTR) bfd_zalloc (abfd, sizeof (struct som_section_data_struct));
if (!newsect->used_by_bfd)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
newsect->alignment_power = 3;
+ sizeof (unsigned int) + len + pad);
if (!obj_som_version_hdr (abfd))
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID;
+ sizeof (unsigned int) + len + pad);
if (!obj_som_copyright_hdr (abfd))
{
- bfd_error = no_error;
+ bfd_set_error (bfd_error_no_error);
abort(); /* FIXME */
}
obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID;
offset += som_section_data (section)->subspace_dict.file_loc_init_value;
if (bfd_seek (abfd, offset, SEEK_SET) == -1)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) location, 1, count, abfd) != count)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
return true;
if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd)
!= lst_header->hash_size * 4)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Seek to the first symbol in this hash chain. */
if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)
!= sizeof (lst_symbol))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
(*count)++;
if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET)
< 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)
!= sizeof (lst_symbol))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
(*count)++;
if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd)
!= lst_header->hash_size * 4)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
in the carsym's filepos field. */
if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
sizeof (struct som_entry), abfd)
!= lst_header->module_count * sizeof (struct som_entry))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Seek to and read the first symbol on the chain. */
if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)
!= sizeof (lst_symbol))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_seek (abfd, lst_filepos + lst_header->string_loc
+ lst_symbol.name.n_strx - 4, SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read (&len, 1, 4, abfd) != 4)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
set->name = bfd_zalloc (abfd, len + 1);
if (!set->name)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_read (set->name, 1, len, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
set->name[len] = 0;
if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET)
< 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)
!= sizeof (lst_symbol))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_seek (abfd, lst_filepos + lst_header->string_loc
+ lst_symbol.name.n_strx - 4, SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read (&len, 1, 4, abfd) != 4)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
set->name = bfd_zalloc (abfd, len + 1);
if (!set->name)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_read (set->name, 1, len, abfd) != len)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
set->name[len] = 0;
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_read ((PTR) &ar_header, 1, sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (strncmp (ar_header.ar_fmag, ARFMAG, 2))
{
- bfd_error = malformed_archive;
+ bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
parsed_size = strtol (ar_header.ar_size, NULL, 10);
if (errno != 0)
{
- bfd_error = malformed_archive;
+ bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
if (bfd_read ((PTR) & lst_header, 1, sizeof (struct lst_header), abfd)
!= sizeof (struct lst_header))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Sanity check. */
if (lst_header.a_magic != LIBMAGIC)
{
- bfd_error = malformed_archive;
+ bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
if (bfd_seek (abfd, ardata->first_file_filepos - parsed_size
+ sizeof (struct lst_header), SEEK_SET) < 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
* sizeof (carsym)));
if (!ardata->symdefs)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_write ((PTR) hash_table, lst.hash_size, 4, abfd)
!= lst.hash_size * 4)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
sizeof (struct som_entry), abfd)
!= lst.module_count * sizeof (struct som_entry))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) lst_syms, nsyms, sizeof (struct lst_symbol_record), abfd)
!= nsyms * sizeof (struct lst_symbol_record))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* And finally the strings. */
if (bfd_write ((PTR) strings, string_size, 1, abfd) != string_size)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* We'll use this for the archive's date and mode later. */
if (stat (abfd->filename, &statbuf) != 0)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
/* Fudge factor. */
if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
if (bfd_write ((PTR) &lst, 1, sizeof (struct lst_header), abfd)
!= sizeof (struct lst_header))
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}