aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog29
-rw-r--r--bfd/bfd.c8
-rw-r--r--bfd/coff-a29k.c13
-rw-r--r--bfd/coffcode.h10
-rw-r--r--bfd/elf32-ppc.c68
-rw-r--r--bfd/hp300hpux.c42
6 files changed, 94 insertions, 76 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e46e568..3925413 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -5,6 +5,35 @@ Mon Sep 25 16:04:09 1995 Michael Meissner <meissner@tiktok.cygnus.com>
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
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 006b201..d98ad62 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -643,11 +643,11 @@ return true;
}
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);
}
diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c
index be35a6e..4673041 100644
--- a/bfd/coff-a29k.c
+++ b/bfd/coff-a29k.c
@@ -189,24 +189,15 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
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:
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f9c7958..b1814ab 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2455,11 +2455,10 @@ coff_slurp_symbol_table (abfd)
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;
@@ -2799,7 +2798,6 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
unsigned int *src_ptr;
unsigned int *dst_ptr;
{
- fprintf (stderr, "%s\n", reloc->howto->name);
abort ();
}
#endif
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 61865a0..3540d40 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -931,11 +931,11 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
/* 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;
@@ -965,16 +965,16 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
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;
@@ -986,23 +986,23 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
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;
@@ -1065,11 +1065,11 @@ ppc_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
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;
}
@@ -1236,10 +1236,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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;
@@ -1281,11 +1281,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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;
diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c
index 24cc881..54e5e50 100644
--- a/bfd/hp300hpux.c
+++ b/bfd/hp300hpux.c
@@ -16,7 +16,7 @@ GNU General Public License for more details.
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. */
/*
@@ -100,7 +100,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
mkobject
This should also be fixed. */
-#define ARCH 32
#define TARGETNAME "a.out-hp300hpux"
#define MY(OP) CAT(hp300hpux_,OP)
@@ -132,6 +131,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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
@@ -184,7 +186,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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"
@@ -199,7 +201,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* 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;
{
@@ -377,7 +379,8 @@ convert_sym_type (sym_pointer, cache_ptr, abfd)
break;
default:
- fprintf (stderr, "unknown symbol type encountered: %x", name_type);
+ abort ();
+ break;
}
if (name_type & HP_SYMTYPE_EXTERNAL)
new_type |= N_EXT;
@@ -499,11 +502,6 @@ MY (slurp_symbol_table) (abfd)
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);
@@ -536,10 +534,10 @@ MY (slurp_symbol_table) (abfd)
/* 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;
@@ -564,7 +562,7 @@ MY (slurp_symbol_table) (abfd)
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 */
@@ -634,11 +632,12 @@ MY (slurp_symbol_table) (abfd)
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;
@@ -674,8 +673,8 @@ MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols)
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])
@@ -690,8 +689,8 @@ MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols)
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;
@@ -784,7 +783,8 @@ doit:
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));
}