public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: Ulrich Weigand <uweigand@de.ibm.com>, binutils@sourceware.org
Subject: Re: [rfc, v2] Fix ELF synthetic symbol size bug (affects PPC64)
Date: Mon, 12 Nov 2007 03:29:00 -0000	[thread overview]
Message-ID: <20071112032907.GF13318@bubble.grove.modra.org> (raw)
In-Reply-To: <20071106214402.GA18867@caradoc.them.org>

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

  reply	other threads:[~2007-11-12  3:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200711052014.lA5KEiTm019854@d12av02.megacenter.de.ibm.com>
2007-11-06 21:33 ` Ulrich Weigand
2007-11-06 21:44   ` Daniel Jacobowitz
2007-11-12  3:29     ` Alan Modra [this message]
2007-11-12 15:37       ` [rfc, v3] " Ulrich Weigand
2007-11-12 15:45         ` Daniel Jacobowitz
2007-11-15 23:49         ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071112032907.GF13318@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).