This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix ia64 ld bootstrap test
On Wed, Dec 04, 2002 at 11:03:22PM +0100, Jakub Jelinek wrote:
> On Wed, Dec 04, 2002 at 01:55:13PM -0800, H. J. Lu wrote:
> > On Wed, Dec 04, 2002 at 10:45:49PM +0100, Jakub Jelinek wrote:
> > > On Wed, Dec 04, 2002 at 12:09:19PM -0800, H. J. Lu wrote:
> > > > This patch seems to fix ia64 ld bootstrap test.
> > >
> > > That bfd_malloc/free is unnecessary IMHO.
> >
> > Can we use
> >
> > char addr_name [sizeof (...) ...];
> >
> > I know gcc supports it. But I don't know others. We can always use
> > alloca :-).
>
> Older gcc's accepted this in -traditional mode, but that doesn't say
> anything. An HPUX owner is needed here.
> Worst case we can just use char addr_name [34]; which will be enough even if
> both int and long are 64-bit.
We can do
char addr_name [34];
BFD_ASSERT ((sizeof (sec->id)*2 + 1 + sizeof (bfd_vma)*2 + 1) <= 34);
>
> > > len is constant expression and thus a local array can be used instead.
> > > Don't understand why there is no sizeof (bfd_vma)*2 instead of
> > > sizeof (bfd_vma)*4. I thought binutils only support host arches
> > > with 8 bit char.
> >
> > I was wondering the same thing. Shouldn't
> >
> > len = sizeof (sec->id)*2 + 1 + sizeof (bfd_vma)*2 + 1;
> >
> > be enough for
> >
> > sprintf (addr_name, "%x:%lx",
>
> Shouldn't that be actually sizeof (int)*2 + 1 + sizeof (long)*2 + 1?
> Those are the types used in there.
It can be sizeof (int)*2 + 1 + sizeof (long long)*2 + 1.
H.J.