Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp111164lqo; Thu, 9 May 2024 14:22:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWVf0NCcavkkrwlwrQwbplsbyfUY0H1xyKPWCXRoJpObjhqw4oavHgGkeTMXShPOIKUng2qdDWV3ZpMk0SK+1kRMyssdyTWf05rxulkA== X-Google-Smtp-Source: AGHT+IERJg/ntijZ/DNSwITBz3IyTL4VdcipILzvtZu3QTEbWr2kehIOw+2Eb4TqwWDCs3TlgRf1 X-Received: by 2002:a17:906:6bcc:b0:a59:b87d:f81d with SMTP id a640c23a62f3a-a5a2d1afc7fmr72997566b.10.1715289752297; Thu, 09 May 2024 14:22:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715289752; cv=pass; d=google.com; s=arc-20160816; b=or8xQJAnitdXxffz2vmGiClBu6Secor3dFm+nRuyRu2QXZ4K2HMivg8hKbXh0J9iUK 8T7uKsq1YyG0MAHOTLi9pYCmhi4el3RYTCSJYYT27cWlrh7S3T1T5O0PcoLhm5ZTtfoO xpTB9bVI56YtOP3smiZh2cUZDTqONhW8GQHa5B/qUi5G9IABJjbLmVCVQ0IFYY62DrN8 LZ+4OBjmuELK2D9Nds0EEm85iNpyhBeUeOWF1JBGCJMNIOVMCi3DwgCEEXjvfXFuLvPa sp9a4pcRs1iJITsLHejLdlPYh4/9kaDGsGbY+o+7+8yK4RTBwyLcNXRrchkiIX0TWcC/ HRgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TH18ArLbUuZTUGbkFCXfRm7cJw0aLxKp2L+Fea/wyw8=; fh=ZcejuwWBqv7gLKyIaWtE4X2WTeDOK7eoYvSirZwsFIs=; b=OfIoycdahJ/6zbXXui9PlYsvnHXAnR4jf9MzHZMpEWvLJRqpb6NmBTdJ9ua8+9FVA4 y2LE6TBmCGJHgITZgeTMD6yaVX86mO9MW3vCyqC6OJvI66n/djvVYV2RThjBGaxcXBQj r3h+JjfZQHaJKJJkdHc2lyAjk3aJUAGMHtBECOr/IDhq88A+mLB8UH7e0+eZTgkV1nuu qLlO/IlJznVc9qSakjYW3f/WMpln27NYbarA2YMVBFKULYaDQqt+tYEEZFys0muH7pbu RIcv3kyvvcjS7ferF5C2a+pSmftFhHPcvd02+a7BIK0SPBbTeJPsX3NzxZlVE8BpkE7t FQNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yu8nQ5Mi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174988-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21ecesi113427866b.343.2024.05.09.14.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 14:22:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174988-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yu8nQ5Mi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174988-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 057EA1F22482 for ; Thu, 9 May 2024 21:22:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6C73129A6A; Thu, 9 May 2024 21:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Yu8nQ5Mi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0584E84FB1; Thu, 9 May 2024 21:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715289719; cv=none; b=Iqs52Ci1x+6pmOcqfYTElEscbsjteyFQEDsVZrfhvEV68sYLxyAsoJKEfZSc1gxFrJQtHBPZNQhAaeqREeCk6y6WfRWyekIU6HomCAToJNzrF6EZrdtq/ld4acZ50p7RDO7h6h1922QlmACAK1UvhbXYsfnp7995q0FIJE3QuaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715289719; c=relaxed/simple; bh=8NaOu27Ba2DQElXCBlj4VoleD/3dxECCUoAuTR9sKFs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jSb9fjg7xfQ9pcZA6zPXPO6N4ptC5lu2LM0eNucyDKjKtQf28UMMshzoAygbGL+PXMAgwDvxcfkSnnK++eBGVtbAXCn/T08o795o7EamDsE9/KoBe9r6q3OxAkzRZQQEDhMWhKIVnFtKtNwLSYgyYNz4J53tG1U85LhASI16aMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yu8nQ5Mi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22C9CC116B1; Thu, 9 May 2024 21:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715289718; bh=8NaOu27Ba2DQElXCBlj4VoleD/3dxECCUoAuTR9sKFs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Yu8nQ5MiN7odJjnzNR2c3eKPT6s7qgplI70Ls9HuGzcyRqLCrE+6D4jn1U1IwWDfi o0F+b24A1yNq/pkvfpN8GoUFVNNVplYev8d2dm63z9r+bPUClT7mFKRLhAicfYrgiq UbjlliqVuaj6cVlZQXdNSJJ+UrgUyGvFVe/EPKW0k7OTJLF/Yy0/dv4mmEZ3hpAfCA a+VGUeWxFMepzOlEcAlNw78VOp/5H6TDcZaPtaUiNkRu8sg1w4EZu1flGUZYIkrdji S7sb2rvyGCzBcoXYe2s0Cw2AJ++P0IMqJbWW2OG3G+HibF3RZitMjXQp79OwatN5IS 3mdaaMxIq0KHw== Date: Thu, 9 May 2024 18:21:55 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: James Clark , linux-perf-users@vger.kernel.org, leo.yan@linux.dev, Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf dwarf-aux: Fix build with HAVE_DWARF_CFI_SUPPORT Message-ID: References: <20240508141458.439017-1-james.clark@arm.com> <20240509101136.5b0e0f2bf8df640fc2e65624@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240509101136.5b0e0f2bf8df640fc2e65624@kernel.org> On Thu, May 09, 2024 at 10:11:36AM +0900, Masami Hiramatsu wrote: > On Wed, 8 May 2024 15:14:57 +0100 > James Clark wrote: > > > 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' > > > > Looks good to me. > > Acked-by: Masami Hiramatsu (Google) > > Thanks! Thanks, applied to perf-tools-next, - Arnaldo > > 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 > > > > > > > -- > Masami Hiramatsu (Google)