Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp531510lqo; Wed, 8 May 2024 07:19:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjWSkXLXIzQminfjfNCAvsMcNCFHK/j6b3mIgWR7eLAfVVicbKUD3qiyGoi86fK1yq6p/Yv09E2aXb6pYcShL30WoStm+GayTcOcywig== X-Google-Smtp-Source: AGHT+IEp0b40ox78Xjbwh1JlRNgwdVqW1mclznfFGgZuO77YizO/BH4oHGzfw6/fVNbP57q3QdS5 X-Received: by 2002:a05:6a00:190a:b0:6f3:ee23:3c39 with SMTP id d2e1a72fcca58-6f49bd7ab87mr4803190b3a.7.1715177983618; Wed, 08 May 2024 07:19:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715177983; cv=pass; d=google.com; s=arc-20160816; b=SEioHPdDfaGvbDcCj8GwuParFe/z9PhfWLvCUHOPbuhDGGNSqb0uA8V3dGCpm3HI/3 D/LvHpVru39377pz1gXQXAf5bSXqJEZWNQZGLpo+7BlH7h7FEjc6VblxI2Wj14QIMK5y VUmc/El3x7jYfJcRDRsXyFhVBI10OPS8X8kb3Ml+y+Yw3ayCVFdl6xap/n8wbtHbU+Jl SruzpUE0LIvoV4JFiX925evEg2p+IwJ7Mfh091LfcmJpbKK8pmAGX16d0h87YzRaA7xK PbHX0WPq4dARDJ66/cwPBnHbHUDFRUS/f35pSfXXKQ5Z4jZge3o2tsuVJWrLm43GmVHc V23w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=7jQ2Jh5rwyOexczsTOPcMMY+wakhkhuTvZAnFvaXoHM=; fh=730Omjw13F448Ulq68H3C4RRbXeDxjf70IshOB7/pEI=; b=k2DQkXjK9C/DtHiMtVhORFortjwZOV/QdRCjUqrQ4RtOgupf28cn7XzfIYy9K6VE+P PNx7enDNfaw7AeeM/RTqJxS+gYt6kxLDIvDUn6T2eITPMUtjK1KvAqikNDX67WRDerb8 0s7QKyj/uEtzAjez1II/Mgj0j6e8Uh2xh2z2lFPg4ajYN2iB1BQgyEOJaFHxnJ+TNHLl b0eszCHuFIWO9p+fJeAbK8ZhpVT1KgqoFj7nQN2+RHC5N4VznXP9bj0NunJb84HYqB+q GEVLqZHg0Zhz7L7B3cekvKKKymAW0DPZ511yxhroDJxlHYDxmvZewoq9Fm7dNhMcZbqb nHuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-173388-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c6-20020a630d06000000b00604765babb6si12442464pgl.609.2024.05.08.07.19.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 07:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173388-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-173388-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 46C5428A822 for ; Wed, 8 May 2024 14:16:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFDFC8562E; Wed, 8 May 2024 14:15:53 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 542D77BB0F; Wed, 8 May 2024 14:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715177753; cv=none; b=glOP3tW5mgZb6BkZNC9vuNtN/6UBeNMrxyX2KQWEq/Bpvm0FsYLb8d2yCee2fBWqafRN7AIcmAy5EOdhLYb/RWFw9hSxs3OJocVu3lnqGmzwKINU03gIBBa9SMtnF4XKaucDyvzAvfxgmfPWcR558kdvPSQbL/0xYpVrn/0DyCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715177753; c=relaxed/simple; bh=6A7Z1g12GoKK+DOAy2tHYcRQ25V+VaPQo8VdbUz1buI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nmOxJQO2agTFyVw1CmVsE/NNDprYEUaFo08ycCMKwF1Dbw4kFq65y8JlfyZRsc2xz63vNkj39ejwN2hy0SjBXFCbdchojbgkpXVGwvhnuun4M+h1AQMoebb/DXYzgqi09uBo0GVogI1eTqdOtRDSnlqGn6vhzU+yT+JxYDhwLC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 44D201007; Wed, 8 May 2024 07:16:16 -0700 (PDT) Received: from e127643.broadband (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 943633F6A8; Wed, 8 May 2024 07:15:48 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org Cc: leo.yan@linux.dev, James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: [PATCH] perf dwarf-aux: Fix build with HAVE_DWARF_CFI_SUPPORT Date: Wed, 8 May 2024 15:14:57 +0100 Message-Id: <20240508141458.439017-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit check_allowed_ops() is used from both HAVE_DWARF_GETLOCATIONS_SUPPORT and HAVE_DWARF_CFI_SUPPORT sections, so move it into the right place so that it's available when either are defined. This shows up when doing a static cross compile for arm64: $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LDFLAGS="-static" \ EXTRA_PERFLIBS="-lexpat" util/dwarf-aux.c:1723:6: error: implicit declaration of function 'check_allowed_ops' Fixes: 55442cc2f22d ("perf dwarf-aux: Check allowed DWARF Ops") Signed-off-by: James Clark --- tools/perf/util/dwarf-aux.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index c0a492e65388..c9584563cd56 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c @@ -1215,6 +1215,34 @@ static int offset_from_dwarf_op(Dwarf_Op *op) } return -1; } + +static bool check_allowed_ops(Dwarf_Op *ops, size_t nops) +{ + /* The first op is checked separately */ + ops++; + nops--; + + /* + * It needs to make sure if the location expression matches to the given + * register and offset exactly. Thus it rejects any complex expressions + * and only allows a few of selected operators that doesn't change the + * location. + */ + while (nops) { + switch (ops->atom) { + case DW_OP_stack_value: + case DW_OP_deref_size: + case DW_OP_deref: + case DW_OP_piece: + break; + default: + return false; + } + ops++; + nops--; + } + return true; +} #endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT || HAVE_DWARF_CFI_SUPPORT */ #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT @@ -1395,34 +1423,6 @@ static bool match_var_offset(Dwarf_Die *die_mem, struct find_var_data *data, return true; } -static bool check_allowed_ops(Dwarf_Op *ops, size_t nops) -{ - /* The first op is checked separately */ - ops++; - nops--; - - /* - * It needs to make sure if the location expression matches to the given - * register and offset exactly. Thus it rejects any complex expressions - * and only allows a few of selected operators that doesn't change the - * location. - */ - while (nops) { - switch (ops->atom) { - case DW_OP_stack_value: - case DW_OP_deref_size: - case DW_OP_deref: - case DW_OP_piece: - break; - default: - return false; - } - ops++; - nops--; - } - return true; -} - /* Only checks direct child DIEs in the given scope. */ static int __die_find_var_reg_cb(Dwarf_Die *die_mem, void *arg) { -- 2.34.1