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 02:20:41PM -0800, H. J. Lu wrote:
> On Thu, Dec 05, 2002 at 08:38:07AM +1030, Alan Modra wrote:
> > On Wed, Dec 04, 2002 at 01:55:13PM -0800, H. J. Lu wrote:
> > > 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",
> >
> > Yes, but since the sprintf is printing an unsigned long, I'd be
> > inclined to use sizeof (unsigned long) * 2 rather than
>
> That won't be right for ia64 cross linker hosted on x86.
Why not. The sprintf argument is long, ELFNN_R_SYM is casted to
unsigned long and never can be more than 32 bits (unless IA-128
uses the same instruction set).
> - len = sizeof (void*)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
> - len += 10; /* %p slop */
> -
> - addr_name = bfd_malloc (len);
> - if (addr_name == NULL)
> - return 0;
> - sprintf (addr_name, "%p:%lx",
> - (void *) abfd, (unsigned long) ELFNN_R_SYM (rel->r_info));
> + sprintf (addr_name, "%x:%lx",
> + sec->id, (unsigned long) ELFNN_R_SYM (rel->r_info));
^^^^^^^^^^^^^^^
Jakub