(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.
+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.
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))
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);
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 */
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;
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;
-
-extern bfd_ec bfd_error;
+ 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;
+
+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));
* sizeof (asection *))));
if (!symndx_to_section)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
/* 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));
external_sections = (char *)bfd_alloc(abfd, readsize);
if (!external_sections)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
goto fail;
}
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 *
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);
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;
* (symbol_count + 1));
if (!newsyms)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
bfd_ptr->outsymbols = newsyms;
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);
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++)
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) {
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));
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;
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;
}
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);
}
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);
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);
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 */
} /* 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);
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 *);
{
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);
{
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;
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));
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));
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;
}
sizeof(arelent_chain));
if (!reloc)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
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;
}
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;
}
|| (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;
if (internal_symhdr->magic != backend->debug_swap.sym_magic)
{
- bfd_error = bad_value;
+ bfd_set_error (bfd_error_bad_value);
return false;
}
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,
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;
}
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;
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);
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);
(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 =
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;
}
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)
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;
}
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. */
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;
}
|| ((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;
}
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;
}
ardata->symdef_count * sizeof (struct symdef)));
if (!symdef_ptr)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
if (!hashtable)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
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;
}
if (bfd_ardata (abfd) == (struct artdata *) NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return (bfd_target *) NULL;
}
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;
}
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,
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;
}
}
if (! bfd_has_map (abfd))
{
- bfd_error = no_symbols;
+ bfd_set_error (bfd_error_no_symbols);
return false;
}
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;
newbuf = (char *) realloc (*buf, have + want);
if (newbuf == NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
*buf = newbuf;
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;
}
sizeof (struct shuffle));
if (!n)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
n->next = NULL;
sizeof (struct shuffle));
if (!n)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
n->next = NULL;
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,
if (!obstack_begin (&ainfo->memory, 4050))
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
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))
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))
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))
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))
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))
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);
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);
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);
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;
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;
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);
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);
/* 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')
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;
/* 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;
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 */
}
if (sect_syms == 0)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
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;
(num_sections + 1) * sizeof (asymbol *));
if (!syms)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
= (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;
}
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;
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;
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;
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") */
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;
}
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;
}
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
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;
}
!= 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. */
if (!native_relocs)
if (!reloc_cache)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
bfd_read ((PTR) native_relocs,
if (!reloc_cache)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
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,
if (!reloc_cache)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
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
if (core_bfd->xvec != exec_bfd->xvec)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
return false;
}
}
else if (hdr->p_filesz > 0)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
return true;
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;
}
if (elf_file_p (&x_ehdr) == false)
{
wrong:
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
return NULL;
}
(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;
}
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++)
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);
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
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;
}
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;
}
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,
(abfd, info, generic_link_check_archive_element);
break;
default:
- bfd_error = wrong_format;
+ bfd_set_error (bfd_error_wrong_format);
ret = false;
}
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;
}
if (! bfd_has_map (abfd))
{
- bfd_error = no_symbols;
+ bfd_set_error (bfd_error_no_symbols);
return false;
}
sizeof (struct bfd_link_hash_entry)));
if (!sub)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
*sub = *h;
relocs = (arelent **) malloc ((size_t) relsize);
if (!relocs)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
reloc_count =
* 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
*psymalloc * sizeof (asymbol *));
if (newsyms == (asymbol **) NULL)
{
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return false;
}
output_bfd->outsymbols = newsyms;
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,
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;
}
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,
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.
*/
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
if (abfd->output_has_begun)
{
- bfd_error = invalid_operation;
+ bfd_set_error (bfd_error_invalid_operation);
return NULL;
}
newsect = (asection *) bfd_zalloc(abfd, sizeof (asection));
if (newsect == NULL) {
- bfd_error = no_memory;
+ bfd_set_error (bfd_error_no_memory);
return NULL;
}
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>>.
*/
@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.
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
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.
*/
the size of any others. */
if (abfd->output_has_begun) {
- bfd_error = invalid_operation;
+ bfd_set_error (bfd_error_invalid_operation);
return false;
}
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
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);
{
case read_direction:
case no_direction:
- bfd_error = invalid_operation;
+ bfd_set_error (bfd_error_invalid_operation);
return false;
case write_direction:
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
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;
}
/* 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.
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>>,
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
extern bfd_target trad_core_vec;
extern bfd_target ptrace_core_vec;
-bfd_target *target_vector[] = {
+bfd_target *bfd_target_vector[] = {
#ifdef SELECT_VECS
&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,
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
/* 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;
}
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;