From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11872 invoked by alias); 3 Nov 2009 20:18:59 -0000 Received: (qmail 11854 invoked by uid 22791); 3 Nov 2009 20:18:59 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Nov 2009 20:18:55 +0000 Received: from sunsite.mff.cuni.cz (localhost [127.0.0.1]) by sunsite.mff.cuni.cz (8.14.3/8.14.3) with ESMTP id nA3KIqLv007383 for ; Tue, 3 Nov 2009 21:18:52 +0100 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.14.3/8.14.3/Submit) id nA3KIqhR007382 for libc-hacker@sources.redhat.com; Tue, 3 Nov 2009 21:18:52 +0100 Date: Tue, 03 Nov 2009 20:18:00 -0000 From: Jakub Jelinek To: Glibc hackers Subject: [PATCH] Fix R_PPC64_{JMP_IREL,IRELATIVE} handling in dl-conflict.c Message-ID: <20091103201852.GH3047@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00000.txt.bz2 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 * 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