This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: BFD 2.16.1 "assertion failure" and "internal error"
- From: Nick Clifton <nickc at redhat dot com>
- To: Daniel Marques <marques at cs dot cornell dot edu>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 06 Jul 2005 11:31:48 +0100
- Subject: Re: BFD 2.16.1 "assertion failure" and "internal error"
- References: <42B99871.7010000@cs.cornell.edu> <42CA8C78.4070308@redhat.com> <42CA8CB7.90805@cs.cornell.edu> <42CAA3E8.3040700@redhat.com> <42CABADB.3030305@cs.cornell.edu>
Hi Daniel,
Attached are two tarballs, one containing the .o files generated by g++,
the other containing those generated by the DEC c++ compiler.
Once untared, do the following:
bash-2.04$ ld -r -o partial.o a.o b.o
bash-2.04$ objcopy partial.o
The g++ compiled objects will produce this error:
BFD: BFD 2.16.1 internal error, aborting at
../../binutils-2.16.1/bfd/coff-alpha.c line 635 in alpha_adjust_reloc_in
OK - I was able to reproduce this error and I am checking in the
attached patch to stop the abort. The problem is that the object files
contain relocs that are not (currently) supported by the linker.
May I ask, which version of g++ are you using and how was it configured ?
The dec c++ compiled objs will produce:
BFD: BFD 2.16.1 assertion fail ../../binutils-2.16.1/bfd/coff-alpha.c:606
BFD: BFD 2.16.1 assertion fail ../../binutils-2.16.1/bfd/coff-alpha.c:606
I could not reproduce this failure, but only because I could not build a
toolchain that would recognise the binaries. So please could you tell
me how you configured a toolchain that did understand these object files ?
Cheers
Nick
bfd/ChangeLog
2005-07-06 Nick Clifton <nickc@redhat.com>
* coff-alpha.c (alpha_adjust_reloc_in): Issue an informative error
message if an unknown reloc is encountered.
(alpha_relocate_section): Likewise.
* ecoff.c (_bfd_ecoff_write_object_contents): Cope with a reloc
with a missing howto field.
Index: bfd/coff-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-alpha.c,v
retrieving revision 1.30
diff -c -3 -p -r1.30 coff-alpha.c
*** bfd/coff-alpha.c 4 May 2005 15:53:01 -0000 1.30
--- bfd/coff-alpha.c 6 Jul 2005 10:23:07 -0000
*************** alpha_adjust_reloc_in (abfd, intern, rpt
*** 632,638 ****
arelent *rptr;
{
if (intern->r_type > ALPHA_R_GPVALUE)
! abort ();
switch (intern->r_type)
{
--- 632,646 ----
arelent *rptr;
{
if (intern->r_type > ALPHA_R_GPVALUE)
! {
! (*_bfd_error_handler)
! (_("%B: unknown/unsupported relocation type %d"),
! abfd, intern->r_type);
! bfd_set_error (bfd_error_bad_value);
! rptr->addend = 0;
! rptr->howto = NULL;
! return;
! }
switch (intern->r_type)
{
*************** alpha_relocate_section (output_bfd, info
*** 1521,1528 ****
switch (r_type)
{
default:
! abort ();
case ALPHA_R_IGNORE:
/* This reloc appears after a GPDISP reloc. On earlier
--- 1529,1554 ----
switch (r_type)
{
+ case ALPHA_R_GPRELHIGH:
+ (*_bfd_error_handler)
+ (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ continue;
+
+ case ALPHA_R_GPRELLOW:
+ (*_bfd_error_handler)
+ (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ continue;
+
default:
! (*_bfd_error_handler)
! (_("%B: unknown relocation type %d"),
! input_bfd, (int) r_type);
! bfd_set_error (bfd_error_bad_value);
! continue;
case ALPHA_R_IGNORE:
/* This reloc appears after a GPDISP reloc. On earlier
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 ecoff.c
*** bfd/ecoff.c 5 Jul 2005 09:45:54 -0000 1.47
--- bfd/ecoff.c 6 Jul 2005 10:23:08 -0000
*************** _bfd_ecoff_write_object_contents (bfd *a
*** 2633,2638 ****
--- 2633,2639 ----
reloc_ptr_ptr = current->orelocation;
reloc_end = reloc_ptr_ptr + current->reloc_count;
out_ptr = (char *) reloc_buff;
+
for (;
reloc_ptr_ptr < reloc_end;
reloc_ptr_ptr++, out_ptr += external_reloc_size)
*************** _bfd_ecoff_write_object_contents (bfd *a
*** 2646,2651 ****
--- 2647,2657 ----
reloc = *reloc_ptr_ptr;
sym = *reloc->sym_ptr_ptr;
+ /* If the howto field has not been initialised then skip this reloc.
+ This assumes that an error message has been issued elsewhere. */
+ if (reloc->howto == NULL)
+ continue;
+
in.r_vaddr = (reloc->address
+ bfd_get_section_vma (abfd, current));
in.r_type = reloc->howto->type;