rather than a direct fprintf.
* archive.c (_bfd_write_archive_contents): Likewise.
* coffcode.h (coff_slurp_symbol_table): Likewise.
* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Likewise.
(ppc_elf_unsupported_reloc): Likewise.
(ppc_elf_relocate_section): Likewise.
* i386linux.c (linux_tally_symbols): Likewise.
(linux_finish_dynamic_link): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* rs6000-core.c (rs6000coff_get_section_contents): Likewise.
* som.c (som_sizeof_headers): Likewise.
* srec.c (srec_bad_byte): Likewise.
* bfd.c (bfd_assert): Likewise. Also change file to be const.
* libbfd-in.h (bfd_assert): Declare first parameter const.
* libbfd.h: Rebuild.
* coff-a29k.c (a29k_reloc): Don't bother to fprintf; returning
bfd_reloc_overflow is enough.
* coff-h8300.c (rtype2howto): Don't bother to fprintf; just abort.
* coff-h8500.c (rtype2howto): Likewise.
* coff-z8k.c (rtype2howto): Likewise.
* coffcode.h (dummy_reloc16_extra_cases): Likewise.
* elf.c (_bfd_elf_get_lineno): Likewise.
(_bfd_elf_no_info_to_howto): Likewise.
(_bfd_elf_no_info_to_howto_rel): Likewise.
* hp300hpux.c (convert_sym_type): Likewise.
(MY(swap_std_reloc_in)): Likewise.
* elf.c (bfd_section_from_shdr): Remove #if 0 sections.
Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
+ * aout-adobe.c (aout_adobe_callback): Use _bfd_error_handler
+ rather than a direct fprintf.
+ * archive.c (_bfd_write_archive_contents): Likewise.
+ * coffcode.h (coff_slurp_symbol_table): Likewise.
+ * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Likewise.
+ (ppc_elf_unsupported_reloc): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ * i386linux.c (linux_tally_symbols): Likewise.
+ (linux_finish_dynamic_link): Likewise.
+ * osf-core.c (osf_core_core_file_p): Likewise.
+ * rs6000-core.c (rs6000coff_get_section_contents): Likewise.
+ * som.c (som_sizeof_headers): Likewise.
+ * srec.c (srec_bad_byte): Likewise.
+ * bfd.c (bfd_assert): Likewise. Also change file to be const.
+ * libbfd-in.h (bfd_assert): Declare first parameter const.
+ * libbfd.h: Rebuild.
+ * coff-a29k.c (a29k_reloc): Don't bother to fprintf; returning
+ bfd_reloc_overflow is enough.
+ * coff-h8300.c (rtype2howto): Don't bother to fprintf; just abort.
+ * coff-h8500.c (rtype2howto): Likewise.
+ * coff-z8k.c (rtype2howto): Likewise.
+ * coffcode.h (dummy_reloc16_extra_cases): Likewise.
+ * elf.c (_bfd_elf_get_lineno): Likewise.
+ (_bfd_elf_no_info_to_howto): Likewise.
+ (_bfd_elf_no_info_to_howto_rel): Likewise.
+ * hp300hpux.c (convert_sym_type): Likewise.
+ (MY(swap_std_reloc_in)): Likewise.
+ * elf.c (bfd_section_from_shdr): Remove #if 0 sections.
+
* libaout.h (struct aoutdata): Add line_buf field.
* aoutx.h (NAME(aout,find_nearest_line)): Remove statics buffer
and filename_buffer. Instead, use a malloc buffer stored in the
}
void
-bfd_assert(file, line)
-char *file;
-int line;
+bfd_assert (file, line)
+ const char *file;
+ int line;
{
- fprintf(stderr, "bfd assertion fail %s:%d\n",file,line);
+ (*_bfd_error_handler) ("bfd assertion fail %s:%d\n", file, line);
}
case R_BYTE:
insn = bfd_get_8(abfd, hit_data);
unsigned_value = insn + sym_value + reloc_entry->addend;
- if (unsigned_value & 0xffffff00) {
- fprintf(stderr,"Relocation problem : ");
- fprintf(stderr,"byte value too large in module %s\n",
- abfd->filename);
+ if (unsigned_value & 0xffffff00)
return(bfd_reloc_overflow);
- }
bfd_put_8(abfd, unsigned_value, hit_data);
break;
case R_HWORD:
insn = bfd_get_16(abfd, hit_data);
unsigned_value = insn + sym_value + reloc_entry->addend;
- if (unsigned_value & 0xffff0000) {
- fprintf(stderr,"Relocation problem : ");
- fprintf(stderr,"hword value too large in module %s\n",
- abfd->filename);
+ if (unsigned_value & 0xffff0000)
return(bfd_reloc_overflow);
- }
-
bfd_put_16(abfd, insn, hit_data);
break;
case R_WORD:
case C_ALIAS: /* duplicate tag */
case C_HIDDEN: /* ext symbol in dmert public lib */
default:
-
- fprintf (stderr, "Unrecognized storage class %d (assuming debugging)\n for %s symbol `%s'\n",
- src->u.syment.n_sclass, dst->symbol.section->name,
- dst->symbol.name);
-/* abort();*/
+ (*_bfd_error_handler)
+ ("%s: Unrecognized storage class %d for %s symbol `%s'",
+ bfd_get_filename (abfd), src->u.syment.n_sclass,
+ dst->symbol.section->name, dst->symbol.name);
dst->symbol.flags = BSF_DEBUGGING;
dst->symbol.value = (src->u.syment.n_value);
break;
unsigned int *src_ptr;
unsigned int *dst_ptr;
{
- fprintf (stderr, "%s\n", reloc->howto->name);
abort ();
}
#endif
/* Check if we have the same endianess */
if (ibfd->xvec->byteorder_big_p != obfd->xvec->byteorder_big_p)
{
- fprintf (stderr,
- "%s: compiled for a %s endian system and target is %s endian.\n",
- bfd_get_filename (ibfd),
- (ibfd->xvec->byteorder_big_p) ? "big" : "little",
- (obfd->xvec->byteorder_big_p) ? "big" : "little");
+ (*_bfd_error_handler)
+ ("%s: compiled for a %s endian system and target is %s endian.\n",
+ bfd_get_filename (ibfd),
+ (ibfd->xvec->byteorder_big_p) ? "big" : "little",
+ (obfd->xvec->byteorder_big_p) ? "big" : "little");
bfd_set_error (bfd_error_wrong_format);
return false;
if ((new_flags & EF_PPC_RELOCATABLE) != 0
&& (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
{
- fprintf (stderr,
- "%s: compiled with -mrelocatable and linked with modules compiled normally\n",
- bfd_get_filename (ibfd));
+ (*_bfd_error_handler)
+ ("%s: compiled with -mrelocatable and linked with modules compiled normally\n",
+ bfd_get_filename (ibfd));
}
else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
&& (old_flags & EF_PPC_RELOCATABLE) != 0)
{
- fprintf (stderr,
- "%s: compiled normally and linked with modules compiled with -mrelocatable\n",
- bfd_get_filename (ibfd));
+ (*_bfd_error_handler)
+ ("%s: compiled normally and linked with modules compiled with -mrelocatable\n",
+ bfd_get_filename (ibfd));
}
else if ((new_flags & EF_PPC_RELOCATABLE_LIB) != 0)
elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE_LIB;
if ((new_flags & EF_PPC_EMB) != 0 && (old_flags & EF_PPC_EMB) == 0)
{
new_flags &= ~EF_PPC_EMB;
- fprintf (stderr,
- "%s: compiled for the eabi and linked with modules compiled for System V\n",
- bfd_get_filename (ibfd));
+ (*_bfd_error_handler)
+ ("%s: compiled for the eabi and linked with modules compiled for System V\n",
+ bfd_get_filename (ibfd));
}
else if ((new_flags & EF_PPC_EMB) == 0 && (old_flags & EF_PPC_EMB) != 0)
{
old_flags &= ~EF_PPC_EMB;
- fprintf (stderr,
- "%s: compiled for System V and linked with modules compiled for eabi\n",
- bfd_get_filename (ibfd));
+ (*_bfd_error_handler)
+ ("%s: compiled for System V and linked with modules compiled for eabi\n",
+ bfd_get_filename (ibfd));
}
/* Warn about any other mismatches */
if (new_flags != old_flags)
- fprintf (stderr,
- "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)\n",
- bfd_get_filename (ibfd), (long)new_flags, (long)old_flags);
+ (*_bfd_error_handler)
+ ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)\n",
+ bfd_get_filename (ibfd), (long)new_flags, (long)old_flags);
bfd_set_error (bfd_error_bad_value);
return false;
char **error_message;
{
BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
- fprintf (stderr,
- "%s: Relocation %s (%d) is not currently supported.\n",
- bfd_get_filename (abfd),
- reloc_entry->howto->name,
- reloc_entry->howto->type);
+ (*_bfd_error_handler)
+ ("%s: Relocation %s (%d) is not currently supported.\n",
+ bfd_get_filename (abfd),
+ reloc_entry->howto->name,
+ reloc_entry->howto->type);
return bfd_reloc_notsupported;
}
/* Unknown relocation handling */
if ((unsigned)r_type >= (unsigned)R_PPC_max || !ppc_elf_howto_table[(int)r_type])
{
- fprintf (stderr,
- "%s: Unknown relocation type %d\n",
- bfd_get_filename (input_bfd),
- (int)r_type);
+ (*_bfd_error_handler)
+ ("%s: Unknown relocation type %d\n",
+ bfd_get_filename (input_bfd),
+ (int)r_type);
bfd_set_error (bfd_error_bad_value);
ret = false;
/* Complain about known relocation that are not yet supported */
if (howto->special_function == ppc_elf_unsupported_reloc)
{
- fprintf (stderr,
- "%s: Relocation %s (%d) is not currently supported.\n",
- bfd_get_filename (input_bfd),
- howto->name,
- (int)r_type);
+ (*_bfd_error_handler)
+ ("%s: Relocation %s (%d) is not currently supported.\n",
+ bfd_get_filename (input_bfd),
+ howto->name,
+ (int)r_type);
bfd_set_error (bfd_error_bad_value);
ret = false;
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
mkobject
This should also be fixed. */
-#define ARCH 32
#define TARGETNAME "a.out-hp300hpux"
#define MY(OP) CAT(hp300hpux_,OP)
#define MY_canonicalize_reloc hp300hpux_canonicalize_reloc
#define MY_write_object_contents hp300hpux_write_object_contents
+#define MY_read_minisymbols _bfd_generic_read_minisymbols
+#define MY_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
+
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define MY_final_link_callback unused
#define ARCH_SIZE 32
/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
-#define BMAGIC 0415
+#define BMAGIC HPUX_DOT_O_MAGIC
#define QMAGIC 0314
#include "aoutx.h"
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
-static bfd_target *
+static const bfd_target *
MY (callback) (abfd)
bfd *abfd;
{
break;
default:
- fprintf (stderr, "unknown symbol type encountered: %x", name_type);
+ abort ();
+ break;
}
if (name_type & HP_SYMTYPE_EXTERNAL)
new_type |= N_EXT;
if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
return true;
symbol_bytes = exec_hdr (abfd)->a_syms;
- if (symbol_bytes == 0)
- {
- bfd_set_error (bfd_error_no_symbols);
- return false;
- }
strings = (char *) bfd_alloc (abfd,
symbol_bytes + SYM_EXTRA_BYTES);
/* now that we know the symbol count, update the bfd header */
bfd_get_symcount (abfd) = num_syms + num_secondary;
- cached = (aout_symbol_type *)
- bfd_zalloc (abfd, (bfd_size_type) (bfd_get_symcount (abfd) *
- sizeof (aout_symbol_type)));
- if (!cached)
+ cached = ((aout_symbol_type *)
+ bfd_zalloc (abfd,
+ bfd_get_symcount (abfd) * sizeof (aout_symbol_type)));
+ if (cached == NULL && bfd_get_symcount (abfd) != 0)
{
bfd_set_error (bfd_error_no_memory);
return false;
cache_ptr->symbol.value = GET_SWORD (abfd, sym_pointer->e_value);
cache_ptr->desc = bfd_get_16 (abfd, sym_pointer->e_almod);
cache_ptr->type = bfd_get_8 (abfd, sym_pointer->e_type);
- cache_ptr->symbol.udata = 0;
+ cache_ptr->symbol.udata.p = NULL;
length = bfd_get_8 (abfd, sym_pointer->e_length);
cache_ptr->other = length; /* other not used, save length here */
void
-MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols)
+MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
bfd *abfd;
struct hp300hpux_reloc *bytes;
arelent *cache_ptr;
asymbol **symbols;
+ bfd_size_type symcount;
{
int r_index;
int r_extern = 0;
case HP_RSEGMENT_NOOP:
break;
default:
- fprintf (stderr, "illegal relocation segment type: %x\n",
- (bytes->r_type[0]));
+ abort ();
+ break;
}
switch (bytes->r_length[0])
r_length = 2;
break;
default:
- fprintf (stderr, "illegal relocation length: %x\n", bytes->r_length[0]);
- r_length = 0;
+ abort ();
+ break;
}
cache_ptr->howto = howto_table_std + r_length + 4 * r_pcrel;
for (; counter < count; counter++, rptr++, cache_ptr++)
{
- MY (swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols);
+ MY (swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols,
+ bfd_get_symcount (abfd));
}