public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix R_PPC64_{JMP_IREL,IRELATIVE} handling in dl-conflict.c
Date: Tue, 03 Nov 2009 20:18:00 -0000	[thread overview]
Message-ID: <20091103201852.GH3047@sunsite.ms.mff.cuni.cz> (raw)

Hi!

I've just committed STT_GNU_IFUNC ppc/ppc64 support into prelink,
and this patch is needed on the glibc side.  Without it ld.so segfaults,
as in dl-conflict.c sym_map is always NULL.  While dl-machine.h could use
RESOLVE_CONFLICT_FIND_MAP macro to compute it, it doesn't make sense,
because with prelink we know it is already properly relocated (all relative
relocations are applied by prelink).

2009-11-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't
	relocate opd entry when resolving prelink conflicts.

--- libc/sysdeps/powerpc/powerpc64/dl-machine.h.jj	2009-11-02 13:54:31.000000000 +0100
+++ libc/sysdeps/powerpc/powerpc64/dl-machine.h	2009-11-03 17:33:58.000000000 +0100
@@ -531,13 +531,14 @@ auto inline Elf64_Addr __attribute__ ((a
 resolve_ifunc (Elf64_Addr value,
 	       const struct link_map *map, const struct link_map *sym_map)
 {
+#ifndef RESOLVE_CONFLICT_FIND_MAP
   /* The function we are calling may not yet have its opd entry relocated.  */
   Elf64_FuncDesc opd;
   if (map != sym_map
-#if !defined RTLD_BOOTSTRAP && defined SHARED
+# if !defined RTLD_BOOTSTRAP && defined SHARED
       /* Bootstrap map doesn't have l_relocated set for it.  */
       && sym_map != &GL(dl_rtld_map)
-#endif
+# endif
       && !sym_map->l_relocated)
     {
       Elf64_FuncDesc *func = (Elf64_FuncDesc *) value;
@@ -546,6 +547,7 @@ resolve_ifunc (Elf64_Addr value,
       opd.fd_aux = func->fd_aux;
       value = (Elf64_Addr) &opd;
     }
+#endif
   return ((Elf64_Addr (*) (void)) value) ();
 }
 

	Jakub

                 reply	other threads:[~2009-11-03 20:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20091103201852.GH3047@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=libc-hacker@sources.redhat.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).