This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ifunc plt synthetic syms


IRELATIVE relocs in the PLT don't have a symbol, so currently we
generate synthetic symbols for them of *ABS*@plt, which isn't very
helpful.  On RELA targets it's easy to do better, like so

	  * elf.c (_bfd_elf_get_synthetic_symtab): Report addends.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.483
diff -u -p -r1.483 elf.c
--- bfd/elf.c	27 Jun 2009 16:07:09 -0000	1.483
+++ bfd/elf.c	10 Jul 2009 08:08:20 -0000
@@ -8922,7 +8922,17 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
   size = count * sizeof (asymbol);
   p = relplt->relocation;
   for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
-    size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
+    {
+      size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
+      if (p->addend != 0)
+	{
+#ifdef BFD64
+	  size += sizeof ("+0x") - 1 + 8 + 8 * (bed->s->elfclass == ELFCLASS64);
+#else
+	  size += sizeof ("+0x") - 1 + 8;
+#endif
+	}
+    }
 
   s = *ret = bfd_malloc (size);
   if (s == NULL)
@@ -8953,6 +8963,13 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
       len = strlen ((*p->sym_ptr_ptr)->name);
       memcpy (names, (*p->sym_ptr_ptr)->name, len);
       names += len;
+      if (p->addend != 0)
+	{
+	  memcpy (names, "+0x", sizeof ("+0x") - 1);
+	  names += sizeof ("+0x") - 1;
+	  bfd_sprintf_vma (abfd, names, p->addend);
+	  names += strlen (names);
+	}
       memcpy (names, "@plt", sizeof ("@plt"));
       names += sizeof ("@plt");
       ++s, ++n;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]