From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32423 invoked by alias); 15 Jun 2009 12:21:02 -0000 Received: (qmail 32399 invoked by uid 22791); 15 Jun 2009 12:21:01 -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; Mon, 15 Jun 2009 12:20:54 +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 n5FCKaW7001293; Mon, 15 Jun 2009 14:20:36 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.14.3/8.14.3/Submit) id n5FCKaQq001292; Mon, 15 Jun 2009 14:20:36 +0200 Date: Mon, 15 Jun 2009 12:21:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] libc part of prelink IFUNC support Message-ID: <20090615122036.GM3101@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-06/txt/msg00002.txt.bz2 Hi! The dl-lookup.c changes are needed for prelink (support in prelink checked into SVN, tested for both i?86 and x86-64), dl-irel.h just something I discovered by code inspection. 2009-06-15 Jakub Jelinek * elf/dl-lookup.c (_dl_debug_bindings): When resolving to STT_GNU_IFUNC symbol or in 8 into type_class. * sysdeps/i386/dl-irel.h (elf_irel): Use Elf32_Addr type instead of Elf64_Addr. --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -1,5 +1,5 @@ /* Look up a symbol in the loaded objects. - Copyright (C) 1995-2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -542,15 +542,20 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, conflict = 1; } - if (value->s - && (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info) - == STT_TLS, 0))) - type_class = 4; + if (value->s) + { + if (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info) + == STT_TLS, 0)) + type_class = 4; + else if (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info) + == STT_GNU_IFUNC, 0)) + type_class |= 8; + } if (conflict || GLRO(dl_trace_prelink_map) == undef_map || GLRO(dl_trace_prelink_map) == NULL - || type_class == 4) + || type_class >= 4) { _dl_printf ("%s 0x%0*Zx 0x%0*Zx -> 0x%0*Zx 0x%0*Zx ", conflict ? "conflict" : "lookup", --- a/sysdeps/i386/dl-irel.h +++ b/sysdeps/i386/dl-irel.h @@ -35,7 +35,7 @@ elf_irel (const Elf32_Rel *reloc) if (__builtin_expect (r_type == R_386_IRELATIVE, 1)) { - Elf64_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) (); + Elf32_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) (); *reloc_addr = value; } else Jakub