* bfd.c (bfd_get_error, bfd_set_error): New functions.

(bfd_error): Make static.
	(bfd_error_type): Renamed from bfd_ec.  Prepend "bfd_error_" to
	all values.
	* bfd-in2.h: Regenerated.
	* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
	aoutf1.h, aoutx.h, archive.c, archures.c,
	bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
	coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
	ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
	elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
	i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
	lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
	nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
	ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
	srec.c, sunos.c, syms.c, targets.c, tekhex.c,
	trad-core.c: Change callers.
This commit is contained in:
David MacKenzie 1994-02-17 18:08:41 +00:00
parent 166557e7b1
commit d1ad85a6e6
15 changed files with 303 additions and 269 deletions

View File

@ -1,3 +1,23 @@
Thu Feb 17 08:30:53 1994 David J. Mackenzie (djm@thepub.cygnus.com)
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
Tue Feb 15 22:27:27 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
* som.c: Remove FIXMEs for things which have been dealt with.

View File

@ -47,7 +47,7 @@ DEFUN(encap_object_p,(abfd),
struct external_exec exec_bytes;
struct internal_exec exec;
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
if (bfd_read ((PTR)magicbuf, 1, sizeof (magicbuf), abfd) !=
sizeof (magicbuf))
@ -67,7 +67,7 @@ DEFUN(encap_object_p,(abfd),
struct external_exec exec_bytes;
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
!= EXEC_BYTES_SIZE) {
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return 0;
}
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);

View File

@ -975,6 +975,7 @@ enum bfd_architecture
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_h8300 1
#define bfd_mach_h8300h 2
bfd_arch_powerpc, /* PowerPC */
bfd_arch_rs6000, /* IBM RS/6000 */
bfd_arch_hppa, /* HP PA RISC */
bfd_arch_z8k, /* Zilog Z8000 */
@ -1494,6 +1495,15 @@ typedef enum bfd_reloc_code_real
BFD_RELOC_386_GOTOFF,
BFD_RELOC_386_GOTPC,
/* PowerPC/POWER (RS/6000) relocs. */
/* 26 bit relative branch. Low two bits must be zero. High 24
bits installed in bits 6 through 29 of instruction. */
BFD_RELOC_PPC_B26,
/* 26 bit absolute branch, like BFD_RELOC_PPC_B26 but absolute. */
BFD_RELOC_PPC_BA26,
/* 16 bit TOC relative reference. */
BFD_RELOC_PPC_TOC16,
/* this must be the highest numeric value */
BFD_RELOC_UNUSED
} bfd_reloc_code_real_type;
@ -1782,29 +1792,33 @@ struct _bfd
typedef enum bfd_error
{
no_error = 0,
system_call_error,
invalid_target,
wrong_format,
invalid_operation,
no_memory,
no_symbols,
no_more_archived_files,
malformed_archive,
file_not_recognized,
file_ambiguously_recognized,
no_contents,
nonrepresentable_section,
no_debug_section,
bad_value,
file_truncated,
invalid_error_code
} bfd_ec;
bfd_error_no_error = 0,
bfd_error_system_call,
bfd_error_invalid_target,
bfd_error_wrong_format,
bfd_error_invalid_operation,
bfd_error_no_memory,
bfd_error_no_symbols,
bfd_error_no_more_archived_files,
bfd_error_malformed_archive,
bfd_error_file_not_recognized,
bfd_error_file_ambiguously_recognized,
bfd_error_no_contents,
bfd_error_nonrepresentable_section,
bfd_error_no_debug_section,
bfd_error_bad_value,
bfd_error_file_truncated,
bfd_error_invalid_error_code
} bfd_error_type;
extern bfd_ec bfd_error;
bfd_error_type
bfd_get_error PARAMS ((void));
void
bfd_set_error PARAMS ((bfd_error_type error_tag));
CONST char *
bfd_errmsg PARAMS ((bfd_ec error_tag));
bfd_errmsg PARAMS ((bfd_error_type error_tag));
void
bfd_perror PARAMS ((CONST char *message));

View File

@ -1325,7 +1325,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
* sizeof (asection *))));
if (!symndx_to_section)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}

View File

@ -57,7 +57,7 @@ DEFUN(make_a_section_from_file,(abfd, hdr, target_index),
/* Assorted wastage to null-terminate the name, thanks AT&T! */
name = bfd_alloc(abfd, sizeof (hdr->s_name)+1);
if (name == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
strncpy(name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@ -134,7 +134,7 @@ DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
external_sections = (char *)bfd_alloc(abfd, readsize);
if (!external_sections)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
goto fail;
}
@ -183,7 +183,7 @@ DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
return (bfd_target *)NULL;
}
/* Turn a COFF file into a BFD, but fail with wrong_format if it is
/* Turn a COFF file into a BFD, but fail with bfd_error_wrong_format if it is
not a COFF file. This is also used by ECOFF. */
bfd_target *
@ -197,7 +197,7 @@ DEFUN(coff_object_p,(abfd),
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
/* figure out how much to read */
filhsz = bfd_coff_filhsz (abfd);
@ -212,7 +212,7 @@ DEFUN(coff_object_p,(abfd),
bfd_release (abfd, filehdr);
if (bfd_coff_bad_format_hook (abfd, &internal_f) == false) {
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return 0;
}
nscns =internal_f.f_nscns;
@ -451,7 +451,7 @@ DEFUN(coff_renumber_symbols,(bfd_ptr),
* (symbol_count + 1));
if (!newsyms)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
bfd_ptr->outsymbols = newsyms;
@ -688,7 +688,7 @@ unsigned int written)
buf = bfd_alloc (abfd, symesz);
if (!buf)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
bfd_coff_swap_sym_out(abfd, &native->u.syment, buf);
@ -704,7 +704,7 @@ unsigned int written)
buf = bfd_alloc (abfd, auxesz);
if (!buf)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
for (j = 0; j < native->u.syment.n_numaux; j++)
@ -940,7 +940,7 @@ DEFUN(coff_write_linenumbers,(abfd),
buff = bfd_alloc (abfd, linesz);
if (!buff)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return;
}
for (s = abfd->sections; s != (asection *) NULL; s = s->next) {
@ -1011,7 +1011,7 @@ coff_section_symbol (abfd, name)
f = (struct foo *) bfd_alloc_by_size_t (abfd, sizeof (*f));
if (!f)
{
bfd_error = no_error;
bfd_set_error (bfd_error_no_error);
return NULL;
}
memset ((char *) f, 0, sizeof (*f));
@ -1078,18 +1078,18 @@ bfd *abfd)
if (bfd_read((char *) string_table_size_buffer,
sizeof(string_table_size_buffer),
1, abfd) != sizeof(string_table_size)) {
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return (NULL);
} /* on error */
string_table_size = bfd_h_get_32(abfd, (bfd_byte *) string_table_size_buffer);
if ((string_table = (PTR) bfd_alloc(abfd, string_table_size -= 4)) == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
} /* on mallocation error */
if (bfd_read(string_table, string_table_size, 1, abfd) != string_table_size) {
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return (NULL);
}
return string_table;
@ -1109,14 +1109,14 @@ DEFUN(build_debug_section,(abfd),
asection *sect = bfd_get_section_by_name (abfd, ".debug");
if (!sect) {
bfd_error = no_debug_section;
bfd_set_error (bfd_error_no_debug_section);
return NULL;
}
debug_section = (PTR) bfd_alloc (abfd,
bfd_get_section_size_before_reloc (sect));
if (debug_section == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -1129,7 +1129,7 @@ DEFUN(build_debug_section,(abfd),
if (bfd_read (debug_section,
bfd_get_section_size_before_reloc (sect), 1, abfd)
!= bfd_get_section_size_before_reloc(sect)) {
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return NULL;
}
bfd_seek (abfd, position, SEEK_SET);
@ -1156,7 +1156,7 @@ DEFUN(copy_name,(abfd, name, maxlen),
}
if ((newname = (PTR) bfd_alloc(abfd, len+1)) == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
}
strncpy(newname, name, len);
@ -1190,14 +1190,14 @@ bfd *abfd)
return obj_raw_syments(abfd);
}
if ((size = bfd_get_symcount(abfd) * sizeof(combined_entry_type)) == 0) {
bfd_error = no_symbols;
bfd_set_error (bfd_error_no_symbols);
return (NULL);
}
internal = (combined_entry_type *)bfd_alloc(abfd, size);
if (!internal)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
internal_end = internal + bfd_get_symcount(abfd);
@ -1207,13 +1207,13 @@ bfd *abfd)
raw = bfd_alloc(abfd,raw_size);
if (!raw)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (bfd_seek(abfd, obj_sym_filepos(abfd), SEEK_SET) == -1
|| bfd_read(raw, raw_size, 1, abfd) != raw_size) {
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return (NULL);
}
/* mark the end of the symbols */
@ -1307,7 +1307,7 @@ bfd *abfd)
} /* possible lengths of this string. */
if ((newstring = (PTR) bfd_alloc(abfd, ++i)) == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
} /* on error */
memset(newstring, 0, i);
@ -1349,7 +1349,7 @@ DEFUN (coff_get_reloc_upper_bound, (abfd, asect),
sec_ptr asect)
{
if (bfd_get_format(abfd) != bfd_object) {
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
return (asect->reloc_count + 1) * sizeof(arelent *);
@ -1361,7 +1361,7 @@ DEFUN (coff_make_empty_symbol, (abfd),
{
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc(abfd, sizeof(coff_symbol_type));
if (new == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
} /* on error */
memset (new, 0, sizeof *new);
@ -1383,14 +1383,14 @@ coff_bfd_make_debug_symbol (abfd, ptr, sz)
{
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc(abfd, sizeof(coff_symbol_type));
if (new == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
} /* on error */
/* @@ This shouldn't be using a constant multiplier. */
new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10);
if (!new->native)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (NULL);
} /* on error */
new->symbol.section = &bfd_debug_section;

View File

@ -49,7 +49,7 @@ DEFUN(bfd_core_file_failing_command,(abfd),
bfd *abfd)
{
if (abfd->format != bfd_core) {
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return NULL;
}
return BFD_SEND (abfd, _core_file_failing_command, (abfd));
@ -72,7 +72,7 @@ bfd_core_file_failing_signal (abfd)
bfd *abfd;
{
if (abfd->format != bfd_core) {
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
@ -97,7 +97,7 @@ core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd, *exec_bfd;
{
if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return false;
}

View File

@ -135,7 +135,7 @@ DEFUN(bfd_constructor_entry,(abfd, symbol_ptr_ptr, type),
sizeof(arelent_chain));
if (!reloc)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}

View File

@ -79,7 +79,7 @@ ecoff_mkobject (abfd)
bfd_zalloc (abfd, sizeof (ecoff_data_type)));
if (abfd->tdata.ecoff_obj_data == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -627,7 +627,7 @@ ecoff_slurp_symbolic_header (abfd)
external_hdr_size = backend->debug_swap.external_hdr_size;
if (bfd_get_symcount (abfd) != external_hdr_size)
{
bfd_error = bad_value;
bfd_set_error (bfd_error_bad_value);
return false;
}
@ -637,7 +637,7 @@ ecoff_slurp_symbolic_header (abfd)
|| (bfd_read (raw, external_hdr_size, 1, abfd)
!= external_hdr_size))
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
@ -645,7 +645,7 @@ ecoff_slurp_symbolic_header (abfd)
if (internal_symhdr->magic != backend->debug_swap.sym_magic)
{
bfd_error = bad_value;
bfd_set_error (bfd_error_bad_value);
return false;
}
@ -730,7 +730,7 @@ ecoff_slurp_symbolic_info (abfd)
raw = (PTR) bfd_alloc (abfd, raw_size);
if (raw == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_seek (abfd,
@ -739,7 +739,7 @@ ecoff_slurp_symbolic_info (abfd)
SEEK_SET) != 0
|| bfd_read (raw, raw_size, 1, abfd) != raw_size)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
bfd_release (abfd, raw);
return false;
}
@ -781,7 +781,7 @@ ecoff_slurp_symbolic_info (abfd)
sizeof (struct fdr)));
if (ecoff_data (abfd)->debug_info.fdr == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
external_fdr_size = backend->debug_swap.external_fdr_size;
@ -817,7 +817,7 @@ ecoff_make_empty_symbol (abfd)
new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type));
if (new == (ecoff_symbol_type *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (asymbol *) NULL;
}
memset (new, 0, sizeof *new);
@ -1044,7 +1044,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, indirect_ptr_ptr)
copy = (char *) bfd_alloc (abfd, strlen (name) + 1);
if (!copy)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
strcpy (copy, name);
@ -1056,7 +1056,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, indirect_ptr_ptr)
(arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
if (!reloc_chain)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
reloc_chain->relent.sym_ptr_ptr =
@ -1130,7 +1130,7 @@ ecoff_slurp_symbol_table (abfd)
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
if (internal == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -1808,7 +1808,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
if (internal_relocs == (arelent *) NULL
|| external_relocs == (char *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
@ -1816,7 +1816,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
if (bfd_read (external_relocs, 1, external_relocs_size, abfd)
!= external_relocs_size)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
@ -2486,7 +2486,7 @@ ecoff_write_object_contents (abfd)
struct internal_aouthdr internal_a;
int i;
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
/* Determine where the sections and relocs will go in the output
file. */
@ -2742,7 +2742,7 @@ ecoff_write_object_contents (abfd)
buff = bfd_alloc (abfd, current->reloc_count * external_reloc_size);
if (buff == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -2976,7 +2976,7 @@ ecoff_slurp_armap (abfd)
|| ((nextname[ARMAP_OBJECT_ENDIAN_INDEX] == ARMAP_BIG_ENDIAN)
^ (abfd->xvec->byteorder_big_p != false)))
{
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return false;
}
@ -2991,13 +2991,13 @@ ecoff_slurp_armap (abfd)
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
if (raw_armap == (char *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
{
bfd_error = malformed_archive;
bfd_set_error (bfd_error_malformed_archive);
bfd_release (abfd, (PTR) raw_armap);
return false;
}
@ -3062,7 +3062,7 @@ ecoff_slurp_armap (abfd)
ardata->symdef_count * sizeof (struct symdef)));
if (!symdef_ptr)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -3179,7 +3179,7 @@ ecoff_write_armap (abfd, elength, map, orl_count, stridx)
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
if (!hashtable)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -3268,7 +3268,7 @@ ecoff_archive_p (abfd)
if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG
|| strncmp (armag, ARMAG, SARMAG) != 0)
{
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return (bfd_target *) NULL;
}
@ -3280,7 +3280,7 @@ ecoff_archive_p (abfd)
if (bfd_ardata (abfd) == (struct artdata *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (bfd_target *) NULL;
}
@ -3334,7 +3334,7 @@ ecoff_link_hash_newfunc (entry, table, string)
bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry)));
if (ret == (struct ecoff_link_hash_entry *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -3366,7 +3366,7 @@ ecoff_bfd_link_hash_table_create (abfd)
malloc (sizeof (struct ecoff_link_hash_table)));
if (!ret)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (! _bfd_link_hash_table_init (&ret->root, abfd,
@ -3412,7 +3412,7 @@ ecoff_bfd_link_add_symbols (abfd, info)
case bfd_archive:
return ecoff_link_add_archive_symbols (abfd, info);
default:
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return false;
}
}
@ -3439,7 +3439,7 @@ ecoff_link_add_archive_symbols (abfd, info)
if (! bfd_has_map (abfd))
{
bfd_error = no_symbols;
bfd_set_error (bfd_error_no_symbols);
return false;
}
@ -3744,7 +3744,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
ext_count * sizeof (struct bfd_link_hash_entry *)));
if (!sym_hash)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
ecoff_data (abfd)->sym_hashes = sym_hash;

View File

@ -74,7 +74,7 @@ ecoff_add_bytes (buf, bufend, need)
newbuf = (char *) realloc (*buf, have + want);
if (newbuf == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
*buf = newbuf;
@ -117,7 +117,7 @@ string_hash_newfunc (entry, table, string)
bfd_hash_allocate (table, sizeof (struct string_hash_entry)));
if (ret == (struct string_hash_entry *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -237,7 +237,7 @@ add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
sizeof (struct shuffle));
if (!n)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
n->next = NULL;
@ -276,7 +276,7 @@ add_memory_shuffle (ainfo, head, tail, data, size)
sizeof (struct shuffle));
if (!n)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
n->next = NULL;
@ -307,7 +307,7 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
ainfo = (struct accumulate *) malloc (sizeof (struct accumulate));
if (!ainfo)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
@ -346,7 +346,7 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
if (!obstack_begin (&ainfo->memory, 4050))
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -478,7 +478,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
rfd_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);
if (!input_debug->ifdmap || !rfd_out)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (!add_memory_shuffle (ainfo, &ainfo->rfd, &ainfo->rfd_end, rfd_out, sz))
@ -574,7 +574,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
fdr_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);
if (!fdr_out)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (!add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, fdr_out, sz))
@ -612,7 +612,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
sym_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);
if (!sym_out)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (!add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, sym_out, sz))
@ -792,7 +792,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);
if (!out)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (!add_memory_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, out, sz))
@ -815,7 +815,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);
if (!out)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
if (!add_memory_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, out, sz))
@ -956,7 +956,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
get_symtab_upper_bound (input_bfd));
if (symbols == (asymbol **) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
sym_end = symbols + bfd_canonicalize_symtab (input_bfd, symbols);
@ -992,7 +992,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
output_swap->external_sym_size);
if (!external_sym)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
(*swap_sym_out) (output_bfd, &internal_sym, external_sym);
@ -1012,7 +1012,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
output_swap->external_fdr_size);
if (!external_fdr)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
(*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr);

View File

@ -383,13 +383,13 @@ DEFUN (bfd_new_strtab, (abfd),
ss = (struct strtab *) malloc (sizeof (struct strtab));
if (!ss)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
ss->tab = malloc (1);
if (!ss->tab)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
*ss->tab = 0;
@ -712,7 +712,7 @@ DEFUN (elf_new_section_hook, (abfd, sec),
sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata));
if (!sdata)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
sec->used_by_bfd = (PTR) sdata;
@ -760,7 +760,7 @@ DEFUN (bfd_section_from_phdr, (abfd, hdr, index),
name = bfd_alloc (abfd, strlen (namebuf) + 1);
if (!name)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
strcpy (name, namebuf);
@ -791,7 +791,7 @@ DEFUN (bfd_section_from_phdr, (abfd, hdr, index),
name = bfd_alloc (abfd, strlen (namebuf) + 1);
if (!name)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
strcpy (name, namebuf);
@ -854,7 +854,7 @@ DEFUN (elf_object_p, (abfd), bfd * abfd)
/* Read in the ELF header in external format. */
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
goto got_system_call_error;
goto got_system_call;
/* Now check to see if we have a valid ELF file, and one that BFD can
make use of. The magic number must match, the address size ('class')
@ -968,11 +968,11 @@ DEFUN (elf_object_p, (abfd), bfd * abfd)
if (!i_shdrp || !elf_elfsections(abfd))
goto got_no_memory_error;
if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) == -1)
goto got_system_call_error;
goto got_system_call;
for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++)
{
if (bfd_read ((PTR) & x_shdr, sizeof x_shdr, 1, abfd) != sizeof (x_shdr))
goto got_system_call_error;
goto got_system_call;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
elf_elfsections(abfd)[shindex] = i_shdrp + shindex;
@ -1035,14 +1035,14 @@ DEFUN (elf_object_p, (abfd), bfd * abfd)
/* If we are going to use goto's to avoid duplicating error setting
and return(NULL) code, then this at least makes it more maintainable. */
got_system_call_error:
bfd_error = system_call_error;
got_system_call:
bfd_set_error (bfd_error_system_call);
goto got_no_match;
got_wrong_format_error:
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
goto got_no_match;
got_no_memory_error:
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
goto got_no_match;
got_no_match:
elf_tdata (abfd) = preserved_tdata;
@ -1166,7 +1166,7 @@ write_relocs (abfd, sec, xxx)
rela_hdr->contents = (void *) bfd_alloc (abfd, rela_hdr->sh_size);
if (!rela_hdr->contents)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
@ -1436,7 +1436,7 @@ DEFUN (elf_map_symbols, (abfd), bfd * abfd)
if (sect_syms == 0)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -1445,7 +1445,7 @@ DEFUN (elf_map_symbols, (abfd), bfd * abfd)
asymbol *sym = bfd_make_empty_symbol (abfd);
if (!sym)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
sym->the_bfd = abfd;
@ -1473,7 +1473,7 @@ DEFUN (elf_map_symbols, (abfd), bfd * abfd)
(num_sections + 1) * sizeof (asymbol *));
if (!syms)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -1491,7 +1491,7 @@ DEFUN (elf_map_symbols, (abfd), bfd * abfd)
= (Elf_Sym_Extra *) bfd_alloc (abfd, symcount * sizeof (Elf_Sym_Extra));
if (!sym_extra)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -1617,7 +1617,7 @@ assign_section_numbers (abfd)
bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *));
if (!i_shdrp)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
elf_elfsections(abfd) = i_shdrp;
@ -1758,7 +1758,7 @@ map_program_segments (abfd)
s = (struct seg_info *) bfd_alloc (abfd, sizeof (struct seg_info));
if (!s)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
s->next = seg;
@ -1842,7 +1842,7 @@ map_program_segments (abfd)
n_segs * sizeof (Elf_Internal_Phdr));
if (!phdr)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
abort(); /* FIXME */
}
elf_tdata (abfd)->phdr = phdr;
@ -2143,7 +2143,7 @@ swap_out_syms (abfd)
bfd_alloc (abfd, (1 + symcount) * sizeof (Elf_External_Sym));
if (!outbound_syms)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
/* now generate the data (for "contents") */
@ -2305,7 +2305,7 @@ write_shdrs_and_ehdr (abfd)
bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
if (!x_shdrp)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -2356,7 +2356,7 @@ DEFUN (NAME(bfd_elf,write_object_contents), (abfd), bfd * abfd)
if ((abfd->flags & DYNAMIC) != 0)
{
fprintf (stderr, "Writing ELF dynamic objects is not supported\n");
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return false;
}
@ -2586,7 +2586,7 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs),
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
@ -2598,7 +2598,7 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs),
x_symp = (Elf_External_Sym *) malloc (symcount * sizeof (Elf_External_Sym));
if (!symbase || !x_symp)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -2606,7 +2606,7 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs),
!= symcount * sizeof (Elf_External_Sym))
{
free ((PTR) x_symp);
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
/* Skip first symbol, which is a null dummy. */
@ -2777,7 +2777,7 @@ DEFUN (elf_slurp_reloca_table, (abfd, asect, symbols),
if (!native_relocs)
if (!reloc_cache)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
bfd_read ((PTR) native_relocs,
@ -2788,7 +2788,7 @@ DEFUN (elf_slurp_reloca_table, (abfd, asect, symbols),
if (!reloc_cache)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -2924,7 +2924,7 @@ DEFUN (elf_slurp_reloc_table, (abfd, asect, symbols),
bfd_alloc (abfd, asect->reloc_count * sizeof (Elf_External_Rel));
if (!native_relocs)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
bfd_read ((PTR) native_relocs,
@ -2935,7 +2935,7 @@ DEFUN (elf_slurp_reloc_table, (abfd, asect, symbols),
if (!reloc_cache)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -3066,7 +3066,7 @@ DEFUN (elf_make_empty_symbol, (abfd),
newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type));
if (!newsym)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
else
@ -3375,7 +3375,7 @@ DEFUN (elf_core_file_matches_executable_p, (core_bfd, exec_bfd),
if (core_bfd->xvec != exec_bfd->xvec)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
@ -3505,7 +3505,7 @@ DEFUN (elf_corefile_note, (abfd, hdr),
}
else if (hdr->p_filesz > 0)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
return true;
@ -3538,7 +3538,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return NULL;
}
@ -3551,7 +3551,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
if (elf_file_p (&x_ehdr) == false)
{
wrong:
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
@ -3592,7 +3592,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
(struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
if (elf_tdata (abfd) == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -3622,12 +3622,12 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
if (!i_phdrp)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) == -1)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return NULL;
}
for (phindex = 0; phindex < i_ehdrp->e_phnum; phindex++)
@ -3635,7 +3635,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
if (bfd_read ((PTR) & x_phdr, sizeof (x_phdr), 1, abfd)
!= sizeof (x_phdr))
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return NULL;
}
elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);

View File

@ -109,7 +109,7 @@ struct elf_backend_data
permit the backend to set any global information it wishes. When
this is called elf_elfheader is set, but anything else should be
used with caution. If this returns false, the check_format
routine will return a wrong_format error. */
routine will return a bfd_error_wrong_format error. */
boolean (*elf_backend_object_p) PARAMS ((bfd *));
/* A function to do additional symbol processing when reading the

View File

@ -445,7 +445,7 @@ _bfd_link_hash_newfunc (entry, table, string)
bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)));
if (ret == (struct bfd_link_hash_entry *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -559,7 +559,7 @@ generic_link_hash_newfunc (entry, table, string)
bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)));
if (ret == (struct generic_link_hash_entry *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -589,7 +589,7 @@ _bfd_generic_link_hash_table_create (abfd)
malloc (sizeof (struct generic_link_hash_table)));
if (!ret)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return (struct bfd_link_hash_table *) NULL;
}
if (! _bfd_link_hash_table_init (&ret->root, abfd,
@ -621,7 +621,7 @@ _bfd_generic_link_add_symbols (abfd, info)
(abfd, info, generic_link_check_archive_element);
break;
default:
bfd_error = wrong_format;
bfd_set_error (bfd_error_wrong_format);
ret = false;
}
@ -706,7 +706,7 @@ archive_hash_newfunc (entry, table, string)
bfd_hash_allocate (table, sizeof (struct archive_hash_entry)));
if (ret == (struct archive_hash_entry *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -795,7 +795,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
if (! bfd_has_map (abfd))
{
bfd_error = no_symbols;
bfd_set_error (bfd_error_no_symbols);
return false;
}
@ -1436,7 +1436,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
sizeof (struct bfd_link_hash_entry)));
if (!sub)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
*sub = *h;
@ -1520,7 +1520,7 @@ _bfd_generic_final_link (abfd, info)
relocs = (arelent **) malloc ((size_t) relsize);
if (!relocs)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
reloc_count =
@ -1540,7 +1540,7 @@ _bfd_generic_final_link (abfd, info)
* sizeof (arelent *))));
if (!o->orelocation)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
/* Reset the count so that it can be used as an index
@ -1590,7 +1590,7 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
*psymalloc * sizeof (asymbol *));
if (newsyms == (asymbol **) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
output_bfd->outsymbols = newsyms;
@ -1619,7 +1619,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
input_bfd->outsymbols = (asymbol **) bfd_alloc (input_bfd, symsize);
if (!input_bfd->outsymbols)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
input_bfd->symcount = bfd_canonicalize_symtab (input_bfd,
@ -1898,7 +1898,7 @@ bfd_new_link_order (abfd, section)
bfd_alloc_by_size_t (abfd, sizeof (struct bfd_link_order)));
if (!new)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -2015,7 +2015,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order)
input_bfd->outsymbols = (asymbol **) bfd_alloc (input_bfd, symsize);
if (!input_bfd->outsymbols)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
input_bfd->symcount = bfd_canonicalize_symtab (input_bfd,

View File

@ -474,9 +474,9 @@ DESCRIPTION
before it was rewritten....
Possible errors are:
o <<invalid_operation>> -
o <<bfd_error_invalid_operation>> -
If output has already started for this BFD.
o <<no_memory>> -
o <<bfd_error_no_memory>> -
If obstack alloc fails.
*/
@ -508,8 +508,8 @@ DESCRIPTION
is already a section with that name.
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
o <<invalid_operation>> - If output has already started for @var{abfd}.
o <<no_memory>> - If obstack alloc fails.
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
o <<bfd_error_no_memory>> - If obstack alloc fails.
*/
sec_ptr
@ -523,7 +523,7 @@ bfd_make_section_anyway (abfd, name)
if (abfd->output_has_begun)
{
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return NULL;
}
@ -534,7 +534,7 @@ bfd_make_section_anyway (abfd, name)
newsect = (asection *) bfd_zalloc(abfd, sizeof (asection));
if (newsect == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@ -579,8 +579,8 @@ SYNOPSIS
asection *bfd_make_section(bfd *, CONST char *name);
DESCRIPTION
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without setting
bfd_error) without changing the section chain if there is already a
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
bfd_set_error ()) without changing the section chain if there is already a
section named @var{name}. If there is an error, return <<NULL>> and set
<<bfd_error>>.
*/
@ -632,7 +632,7 @@ DESCRIPTION
@var{abfd} to the value @var{flags}. Return <<true>> on success,
<<false>> on error. Possible error returns are:
o <<invalid_operation>> -
o <<bfd_error_invalid_operation>> -
The section cannot have one or more of the attributes
requested. For example, a .bss section in <<a.out>> may not
have the <<SEC_HAS_CONTENTS>> field set.
@ -653,7 +653,7 @@ DEFUN(bfd_set_section_flags,(abfd, section, flags),
set - which it doesn't, at least not for a.out. FIXME */
if ((flags & bfd_applicable_section_flags (abfd)) != flags) {
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return false;
}
#endif
@ -721,7 +721,7 @@ DESCRIPTION
ok, then <<true>> is returned, else <<false>>.
Possible error returns:
o <<invalid_operation>> -
o <<bfd_error_invalid_operation>> -
Writing has started to the BFD, so setting the size is invalid.
*/
@ -736,7 +736,7 @@ DEFUN(bfd_set_section_size,(abfd, ptr, val),
the size of any others. */
if (abfd->output_has_begun) {
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return false;
}
@ -769,7 +769,7 @@ DESCRIPTION
Normally <<true>> is returned, else <<false>>. Possible error
returns are:
o <<no_contents>> -
o <<bfd_error_no_contents>> -
The output section does not have the <<SEC_HAS_CONTENTS>>
attribute, so nothing can be written to it.
o and some more too
@ -797,14 +797,14 @@ DEFUN(bfd_set_section_contents,(abfd, section, location, offset, count),
if (!bfd_get_section_flags(abfd, section) & SEC_HAS_CONTENTS)
{
bfd_error = no_contents;
bfd_set_error (bfd_error_no_contents);
return(false);
}
if (offset < 0)
{
bad_val:
bfd_error = bad_value;
bfd_set_error (bfd_error_bad_value);
return false;
}
sz = bfd_get_section_size_now (abfd, section);
@ -817,7 +817,7 @@ DEFUN(bfd_set_section_contents,(abfd, section, location, offset, count),
{
case read_direction:
case no_direction:
bfd_error = invalid_operation;
bfd_set_error (bfd_error_invalid_operation);
return false;
case write_direction:
@ -884,7 +884,7 @@ DEFUN(bfd_get_section_contents,(abfd, section, location, offset, count),
if (offset < 0)
{
bad_val:
bfd_error = bad_value;
bfd_set_error (bfd_error_bad_value);
return false;
}
/* Even if reloc_done is true, this function reads unrelocated

172
bfd/som.c
View File

@ -1377,7 +1377,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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;
}
@ -1404,7 +1404,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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)
@ -1423,7 +1423,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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;
@ -1437,7 +1437,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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;
@ -1451,7 +1451,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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;
@ -1465,7 +1465,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field)
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;
@ -1601,7 +1601,7 @@ make_unique_section (abfd, name, num)
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);
@ -1806,13 +1806,13 @@ som_object_p (abfd)
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;
}
@ -1836,14 +1836,14 @@ som_object_p (abfd)
#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;
}
@ -1855,7 +1855,7 @@ som_object_p (abfd)
{
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;
}
}
@ -1863,7 +1863,7 @@ som_object_p (abfd)
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;
}
@ -1882,7 +1882,7 @@ som_mkobject (abfd)
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)
@ -1890,7 +1890,7 @@ som_mkobject (abfd)
if (obj_som_file_hdr (abfd) == NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
return true;
@ -2212,7 +2212,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep)
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;
}
@ -2251,7 +2251,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep)
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;
@ -2421,7 +2421,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep)
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;
@ -2458,7 +2458,7 @@ som_write_space_strings (abfd, current_offset, string_sizep)
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;
}
@ -2485,7 +2485,7 @@ som_write_space_strings (abfd, current_offset, string_sizep)
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. */
@ -2522,7 +2522,7 @@ som_write_space_strings (abfd, current_offset, string_sizep)
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;
@ -2553,7 +2553,7 @@ som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep)
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;
}
@ -2568,7 +2568,7 @@ som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep)
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. */
@ -2603,7 +2603,7 @@ som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep)
/* 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;
}
@ -2657,7 +2657,7 @@ som_begin_writing (abfd)
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;
}
@ -2668,7 +2668,7 @@ som_begin_writing (abfd)
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;
}
}
@ -2685,7 +2685,7 @@ som_begin_writing (abfd)
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;
}
@ -2696,7 +2696,7 @@ som_begin_writing (abfd)
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;
}
}
@ -2973,7 +2973,7 @@ som_write_headers (abfd)
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;
}
}
@ -3032,7 +3032,7 @@ som_write_headers (abfd)
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;
}
}
@ -3061,7 +3061,7 @@ som_write_headers (abfd)
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;
}
@ -3076,7 +3076,7 @@ som_write_headers (abfd)
sizeof (struct header), 1, abfd)
!= sizeof (struct header))
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
return true;
@ -3245,13 +3245,13 @@ som_build_and_write_symbol_table (abfd)
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;
@ -3302,20 +3302,20 @@ som_slurp_string_table (abfd)
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;
}
@ -3383,7 +3383,7 @@ som_slurp_symbol_table (abfd)
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;
}
@ -3391,18 +3391,18 @@ som_slurp_symbol_table (abfd)
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);
}
@ -3550,7 +3550,7 @@ som_make_empty_symbol (abfd)
(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;
@ -3852,7 +3852,7 @@ som_slurp_reloc_table (abfd, section, symbols, just_count)
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. */
@ -3861,13 +3861,13 @@ som_slurp_reloc_table (abfd, section, symbols, just_count)
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.
@ -3894,7 +3894,7 @@ som_slurp_reloc_table (abfd, section, symbols, just_count)
num_relocs * sizeof (arelent));
if (internal_relocs == (arelent *) NULL)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -3968,7 +3968,7 @@ som_new_section_hook (abfd, newsect)
(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;
@ -4069,7 +4069,7 @@ bfd_som_attach_aux_hdr (abfd, type, string)
+ 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;
@ -4090,7 +4090,7 @@ bfd_som_attach_aux_hdr (abfd, type, string)
+ 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;
@ -4133,13 +4133,13 @@ som_set_section_contents (abfd, section, location, offset, count)
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;
@ -4261,7 +4261,7 @@ som_bfd_count_ar_symbols (abfd, lst_header, 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;
}
@ -4278,7 +4278,7 @@ som_bfd_count_ar_symbols (abfd, lst_header, count)
/* 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;
}
@ -4286,7 +4286,7 @@ som_bfd_count_ar_symbols (abfd, lst_header, count)
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)++;
@ -4299,7 +4299,7 @@ som_bfd_count_ar_symbols (abfd, lst_header, 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;
}
@ -4307,7 +4307,7 @@ som_bfd_count_ar_symbols (abfd, lst_header, count)
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)++;
@ -4336,7 +4336,7 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4344,7 +4344,7 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4352,7 +4352,7 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4368,14 +4368,14 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
/* 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;
}
@ -4389,13 +4389,13 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4403,12 +4403,12 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
@ -4428,14 +4428,14 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4443,13 +4443,13 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
}
@ -4457,12 +4457,12 @@ som_bfd_fill_in_ar_symbols (abfd, lst_header, syms)
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;
@ -4501,7 +4501,7 @@ som_slurp_armap (abfd)
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) < 0)
{
bfd_error = system_call_error;
bfd_set_error (bfd_error_system_call);
return false;
}
@ -4516,13 +4516,13 @@ som_slurp_armap (abfd)
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;
}
@ -4531,7 +4531,7 @@ som_slurp_armap (abfd)
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;
}
@ -4543,14 +4543,14 @@ som_slurp_armap (abfd)
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;
}
@ -4563,7 +4563,7 @@ som_slurp_armap (abfd)
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;
}
@ -4574,7 +4574,7 @@ som_slurp_armap (abfd)
* sizeof (carsym)));
if (!ardata->symdefs)
{
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return false;
}
@ -4840,7 +4840,7 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
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;
}
@ -4849,7 +4849,7 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
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;
}
@ -4857,14 +4857,14 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
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;
}
@ -4889,7 +4889,7 @@ som_write_armap (abfd)
/* 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. */
@ -4975,7 +4975,7 @@ som_write_armap (abfd)
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;
}
@ -4983,7 +4983,7 @@ som_write_armap (abfd)
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;
}

View File

@ -1,5 +1,5 @@
/* Generic target-file-type support for the BFD library.
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Copyright 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -39,7 +39,7 @@ DESCRIPTION
how to interpret the file. The operations performed are:
o Create a BFD by calling the internal routine
<<new_bfd>>, then call <<bfd_find_target>> with the
<<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
target string supplied to <<bfd_openr>> and the new BFD pointer.
o If a null target string was provided to <<bfd_find_target>>,
@ -56,7 +56,7 @@ DESCRIPTION
one by one, until a match on target name is found. When found,
use it.
o Otherwise return the error <<invalid_target>> to
o Otherwise return the error <<bfd_error_invalid_target>> to
<<bfd_openr>>.
o <<bfd_openr>> attempts to open the file using
@ -414,7 +414,7 @@ extern bfd_target sco_core_vec;
extern bfd_target trad_core_vec;
extern bfd_target ptrace_core_vec;
bfd_target *target_vector[] = {
bfd_target *bfd_target_vector[] = {
#ifdef SELECT_VECS
@ -482,7 +482,7 @@ bfd_target *target_vector[] = {
&hp300bsd_vec,
#endif
&hp300hpux_vec,
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD)
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
&som_vec,
#endif
&i386aout_vec,
@ -563,20 +563,20 @@ bfd_target *target_vector[] = {
NULL /* end of list marker */
};
/* default_vector[0] contains either the address of the default vector,
/* bfd_default_vector[0] contains either the address of the default vector,
if there is one, or zero if there isn't. */
bfd_target *default_vector[] = {
bfd_target *bfd_default_vector[] = {
#ifdef DEFAULT_VECTOR
&DEFAULT_VECTOR,
#endif
NULL
};
/* When there is an ambiguous match, bfd_check_format_ambig puts the names
of the matching targets in an array. This variable is the maximum
number of entries that array could possibly need. */
CONST size_t bfd_default_vector_entries = sizeof(target_vector)/sizeof(*target_vector);
/* When there is an ambiguous match, bfd_check_format_matches puts the
names of the matching targets in an array. This variable is the maximum
number of entries that the array could possibly need. */
CONST size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
/*
FUNCTION
@ -610,17 +610,17 @@ DEFUN(bfd_find_target,(target_name, abfd),
/* This is safe; the vector cannot be null */
if (targname == NULL || !strcmp (targname, "default")) {
abfd->target_defaulted = true;
return abfd->xvec = target_vector[0];
return abfd->xvec = bfd_target_vector[0];
}
abfd->target_defaulted = false;
for (target = &target_vector[0]; *target != NULL; target++) {
for (target = &bfd_target_vector[0]; *target != NULL; target++) {
if (!strcmp (targname, (*target)->name))
return abfd->xvec = *target;
}
bfd_error = invalid_target;
bfd_set_error (bfd_error_invalid_target);
return NULL;
}
@ -651,18 +651,18 @@ DEFUN_VOID(bfd_target_list)
bfd_target **target;
CONST char **name_list, **name_ptr;
for (target = &target_vector[0]; *target != NULL; target++)
for (target = &bfd_target_vector[0]; *target != NULL; target++)
vec_length++;
name_ptr =
name_list = (CONST char **) zalloc ((vec_length + 1) * sizeof (char **));
name_ptr = name_list = (CONST char **)
bfd_zmalloc ((vec_length + 1) * sizeof (char **));
if (name_list == NULL) {
bfd_error = no_memory;
bfd_set_error (bfd_error_no_memory);
return NULL;
}
for (target = &target_vector[0]; *target != NULL; target++)
for (target = &bfd_target_vector[0]; *target != NULL; target++)
*(name_ptr++) = (*target)->name;
return name_list;