[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Linker Utility Assert
From: |
Tom Rix |
Subject: |
Re: GNU Linker Utility Assert |
Date: |
Fri, 22 Mar 2002 07:38:03 -0600 |
It seems to me that a better place to catch this problem would be the assembler.
Could someone send me the original testcase?
Tom
Nick Clifton wrote:
> Hi Charles,
>
> > I'm reporting a bug in the linker. When you attempt to build the
> > following, the following assert occurs:
> >
> > assert "(hds->flags&(040) == 0 && (h->flags & (010000)) == 0" failed file
> > "/cm/src/cygnus/98r2/src/frozen/bfd/xcofflink.c" line 2417
> >
> > The attach file is a tar ball make the creates the problem. The problem
> > occurs when I mistakenly call the toc reference of the c routine
> > instead of the actual name of the function. That is, in the assembler code
> > I called "test_func" instead of ".test_func".
> >
> > The bug is the linker should not assert, even though I've made a coding
> > mistake.
>
> OK - how about this replacement for the assert ? I am not sure if the
> wording is exactly right, since I am unfamiliar with this code. So I
> have included Tom Rix, the PowerPC XCOFF maintainer for binutils, in
> the address list for this email.
>
> Cheers
> Nick
>
> 2002-03-22 Nick Clifton <address@hidden>
>
> * xcofflink.c (xcoff_link_add_symbols): Replace assertion with
> meaningful error message.
>
> Index: bfd/xcofflink.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/xcofflink.c,v
> retrieving revision 1.21
> diff -c -3 -p -w -r1.21 xcofflink.c
> *** xcofflink.c 2002/03/20 12:03:27 1.21
> --- xcofflink.c 2002/03/22 10:20:13
> *************** xcoff_link_add_symbols (abfd, info)
> *** 1989,1996 ****
> goto error_return;
> }
> hds->flags |= XCOFF_DESCRIPTOR;
> ! BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0
> ! && (h->flags & XCOFF_DESCRIPTOR) == 0);
> hds->descriptor = h;
> h->descriptor = hds;
> }
> --- 1989,2004 ----
> goto error_return;
> }
> hds->flags |= XCOFF_DESCRIPTOR;
> ! if ((hds->flags & XCOFF_CALLED) != 0
> ! ||(h->flags & XCOFF_DESCRIPTOR) != 0)
> ! {
> ! (*_bfd_error_handler)
> ! (_("%s: bad relocation between symbols '%s' and
> '%s'"),
> ! bfd_archive_filename (abfd), h->root.root.string,
> ! hds->root.root.string);
> ! bfd_set_error (bfd_error_invalid_operation);
> ! goto error_return;
> ! }
> hds->descriptor = h;
> h->descriptor = hds;
> }
--
Tom Rix
GCC Engineer
address@hidden