[rfc, v2] Fix ELF synthetic symbol size bug (affects PPC64)
Alan Modra
amodra@bigpond.net.au
Mon Nov 12 03:29:00 GMT 2007
On Tue, Nov 06, 2007 at 04:44:02PM -0500, Daniel Jacobowitz wrote:
> > Is the bfd part OK?
>
> The elf.c part of this does not make sense to me. Why should we have
> the same size as that symbol? The @plt entry is only a couple of
> instructions. To figure out its size you need to ask the backend
> plt_sym_val routine.
Agreed. The ppc64 part is OK. I'm committing the following to fix
a bug I noticed in the elf.c get_synthetic_symtab function. I also
set udata.p to NULL as this may be all that's needed with a modified
version of Ulrich's patch.
* elf.c (_bfd_elf_get_synthetic_symtab): Only bump the symbol
pointer when we have a valid symbol. Init udata.p to NULL.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.422
diff -u -p -r1.422 elf.c
--- bfd/elf.c 25 Oct 2007 00:40:34 -0000 1.422
+++ bfd/elf.c 12 Nov 2007 03:21:58 -0000
@@ -8678,7 +8678,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
names = (char *) (s + count);
p = relplt->relocation;
n = 0;
- for (i = 0; i < count; i++, s++, p++)
+ for (i = 0; i < count; i++, p++)
{
size_t len;
bfd_vma addr;
@@ -8695,12 +8695,13 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
s->section = plt;
s->value = addr - plt->vma;
s->name = names;
+ s->udata.p = NULL;
len = strlen ((*p->sym_ptr_ptr)->name);
memcpy (names, (*p->sym_ptr_ptr)->name, len);
names += len;
memcpy (names, "@plt", sizeof ("@plt"));
names += sizeof ("@plt");
- ++n;
+ ++s, ++n;
}
return n;
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list