From patchwork Tue Jul 8 10:35:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 4503751 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20040BEEAA for ; Tue, 8 Jul 2014 10:36:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F40C2020F for ; Tue, 8 Jul 2014 10:36:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D3F52021F for ; Tue, 8 Jul 2014 10:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754057AbaGHKgH (ORCPT ); Tue, 8 Jul 2014 06:36:07 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:39589 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753443AbaGHKgG (ORCPT ); Tue, 8 Jul 2014 06:36:06 -0400 Received: by mail-lb0-f178.google.com with SMTP id 10so3844151lbg.9 for ; Tue, 08 Jul 2014 03:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=fPTNG48HEzGyPsDIuRXfrByB7z1+k7uioVDB14OnJo0=; b=Exvn8DbBlBlenLUja4aVU8ZQ7Otx1ZVD5/aKtxUAk5ZbJFCfPr22hHLVGSixQz5/OU H5lFYZczr9awSaD1Ivu9fKyLJhTA938gAb/pb+ctdIPBsa+4iTPQtVUDvTrw55zQY5Nc avNIhzGd839lTEnYVhCcKEgUZcFoHL7e/ehbq59phn44MTS25mPa8pobxsAv209Y6JCa bfAdwkqR6uRwFrlU5Wwk9NY/ATrf6zvwhoYPJaHpjHKf6g1aAFHj6rf1EiCuNvWSIpYM TwriP4oIykssrompHW1agochf8nOEwtICyhzeiZ/FfR7CADX6+Qlp0fJ+0/F7oV/TdNp VYOA== X-Received: by 10.152.5.230 with SMTP id v6mr27176308lav.33.1404815764702; Tue, 08 Jul 2014 03:36:04 -0700 (PDT) Received: from localhost (95-25-124-72.broadband.corbina.ru. [95.25.124.72]) by mx.google.com with ESMTPSA id i1sm55953990lbj.43.2014.07.08.03.36.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 03:36:03 -0700 (PDT) Subject: [PATCH] scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86 From: Konstantin Khlebnikov To: Andrew Morton Cc: "x86@kernel.org" , Linux Kernel Mailing List , user-mode-linux-devel@lists.sourceforge.net, linux-kbuild@vger.kernel.org Date: Tue, 08 Jul 2014 14:35:57 +0400 Message-ID: <20140708103557.4408.87822.stgit@zurg> In-Reply-To: References: User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for ARCH=x86 into checkstack. commit ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT") had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86. checkstack.pl searches patterns of machine instructions which are usually used for allocating stack frames. checkstalk.pl needs either i386 or x86_64, x86 isn't enough: $ make checkstack objdump -d vmlinux $(find . -name '*.ko') | \ perl linux/scripts/checkstack.pl x86 wrong or unknown architecture "x86" Signed-off-by: Konstantin Khlebnikov --- scripts/checkstack.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index c05d586..899b423 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -52,14 +52,12 @@ my (@stack, $re, $dre, $x, $xs, $funcre); #8000008a: 20 1d sub sp,4 #80000ca8: fa cd 05 b0 sub sp,sp,1456 $re = qr/^.*sub.*sp.*,([0-9]{1,8})/o; - } elsif ($arch =~ /^i[3456]86$/) { + } elsif ($arch =~ /^x86(_64)?$/ || $arch =~ /^i[3456]86$/) { #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp - $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; - $dre = qr/^.*[as][du][db] (%.*),\%esp$/o; - } elsif ($arch eq 'x86_64') { - # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp - $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o; - $dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o; + # or + # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp + $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%(e|r)sp$/o; + $dre = qr/^.*[as][du][db] (%.*),\%(e|r)sp$/o; } elsif ($arch eq 'ia64') { #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;