This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix ia64 ld bootstrap test
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 4 Dec 2002 22:45:49 +0100
- Subject: Re: PATCH: Fix ia64 ld bootstrap test
- References: <20021204120919.A17728@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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.
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.
> 2002-12-04 H.J. Lu <hjl@gnu.org>
>
> * elfxx-ia64.c (get_local_sym_hash): Use section ID instead of
> BFD address when constructing local name.
>
> --- bfd/elfxx-ia64.c.hash Tue Dec 3 21:44:58 2002
> +++ bfd/elfxx-ia64.c Tue Dec 3 23:17:04 2002
> @@ -1837,18 +1837,20 @@ get_local_sym_hash (ia64_info, abfd, rel
> char *addr_name;
> size_t len;
> struct elfNN_ia64_local_hash_entry *ret;
> + asection *sec = abfd->sections;
> +
> + BFD_ASSERT (sec);
>
> /* Construct a string for use in the elfNN_ia64_local_hash_table.
> name describes what was once anonymous memory. */
>
> - len = sizeof (void*)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
> - len += 10; /* %p slop */
> + len = sizeof (sec->id)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
>
> 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));
>
> /* Collect the canonical entry data for this address. */
> ret = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
Jakub