From patchwork Sat Mar 8 18:39:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 16 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id EE57B3600AC for ; Sat, 8 Mar 2014 10:39:37 -0800 (PST) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 92FCA1F57CDA; Sat, 8 Mar 2014 10:39:37 -0800 (PST) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 5EE161F57CC5 for ; Sat, 8 Mar 2014 10:39:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=XK5 eoNO03blMr3l85aw/mQU82Fv2m5rcCLqOzPQIzHLy97UYqvakK4WD1c7N6u0bXVE dLi/HALN2wfUKGJAe8+TkAIeEu5VvaMeDFfwiYY+24sKyRvdGAvRBYa8ScEwNpPL jrDl9r7OpS8S6SCG+m2oqMGQnCLMfCRPz7+APabI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=9XdDO86A9 6ang9srHtqK/W3tpY0=; b=kdb02GpkDzx4SOohwCjrVGXfW7Ju6jR0eq7DkOKuh LRr6rNAtd6q3mUhROypCSbnCoPRSImFEt+YVNP/lo7EnqJ+fqiCvMKhOW1A6ac5a Rl3xEPXC5+5LkADAhzzc1vq52AT+rfguV4tuuQHLEwGvR9+ePyB/ls+P4aPqHKWe PY= Received: (qmail 8823 invoked by alias); 8 Mar 2014 18:39:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 8811 invoked by uid 89); 8 Mar 2014 18:39:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp01.br.ibm.com Message-ID: <531B63DE.5090803@linux.vnet.ibm.com> Date: Sat, 08 Mar 2014 15:39:26 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [PATCH] Fix localplt check for GNU_IFUNC X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14030818-1524-0000-0000-00000924AA39 X-DH-Original-To: glibc@patchwork.siddhesh.in While reviewing the strncat optimization for powerpc64 I noted in the disassembled object that a call to strlen (bl strlen) generates a PLT call to strlen (since now strlen is an IFUNC for powerpc64). Strangely it was not being caught by check-localplt testcase. GNU_IFUNC are shown by readelf in 'Relocation section' value as (symbol) instead of expected hexadecimal value. This causes the check-localplt script to igore potential PLT stub begin generated by wrong IFUNC usage. This patch changes the localplt script to emit such PLT cases. Checked on PPC64 and X86_64. --- 2014-03-03 Adhemerval Zanella * scripts/localplt.awk: Do not ignore IFUNC relocation while parsing relocation sections. --- diff --git a/scripts/localplt.awk b/scripts/localplt.awk index 2265b02..5e38073 100644 --- a/scripts/localplt.awk +++ b/scripts/localplt.awk @@ -32,9 +32,15 @@ $1 == "Offset" && $2 == "Info" { in_relocs = 1; next } NF == 0 { in_relocs = 0 } in_relocs && relocs_offset == jmprel_offset && NF >= 5 { - symval = strtonum("0x" $4); - if (symval != 0) + # Relocations against GNU_IFUNC symbols are not shown as an hexadecimal + # value, but rather as the resolver symbol name between (). + if ($4 ~ /\(.*\)/) { print whatfile, $5 + } else { + symval = strtonum("0x" $4); + if (symval != 0) + print whatfile, $5 + } } in_relocs { next }