Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp758127lqo; Wed, 8 May 2024 14:05:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXx1XXShgcUAOhYKHuhfoUAn8UQLmdoVcWumIO3u7SZ8NC+tzxKNfOi7iYlmNe9H+rs4ee0YMP/1o1EpoUsCaoKVAXAtyJAOm1h/+rCPg== X-Google-Smtp-Source: AGHT+IG1o27bapqiLcepUbg834QKb6FomOjBrmZBq4WljnU7VeIpH6i/yzgQZCyg2UUWRTLBXeue X-Received: by 2002:a17:90a:2f45:b0:2b1:fce5:f308 with SMTP id 98e67ed59e1d1-2b616be563cmr3364147a91.49.1715202326143; Wed, 08 May 2024 14:05:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715202326; cv=pass; d=google.com; s=arc-20160816; b=HonIalSsIt3LKU2Choj9i8kJJM4iGsJWkM8TWDZtmXdBCRCmoRBXimcDcAbuY8AM55 kFQhE845xCg6PfftUyYT/6GHOEOnjOfhy5h8lXlbQqPmWVdaYYojOi/mHKiO8F3rDDQm z9MbApj6daOw3yqMgtBMdWsJHYHq+j5GVdQpF6d6i8MzSxSYz3M4jSTnWrhv3YIYmQ3a GSJ+DLp6V+F9KuefV2kLSR6ySBuunpEby+d8VNCWZW8heqFfck2gVe1K75G5RNyigNhq nVBGOK0HDewb23YEJni+L0VPC0z7XOLh6lbjWSapFnhDR7VMl0GNuQqDC548MUBftkin DVoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=TacJSNF5BN2EAxFL9AKWhV4ZHViuaAA6IA2uXpBpZ4A=; fh=ZsogXW2DH6vw8EtfpDZZqyDgvimL4sDeTaBOncRIV5U=; b=VXDe0gfDp6tjWXpPi3tLWQTHVknoRIcdO0BtvrHmbwJMGsJeP3SNTe5bOVMjjQv21B apobTy1gXY+4TceUvsgIA2tK00jSRk5xRq9LJer0GAsFCgYo4tWexcSzLA4uLXaytsrQ lklEbYqb/kGrxJQIMNR0LXJgd9qAcDKZqnzlLK+tRmTic32UYZXA08mzNm8/IUiWOBcA QCDBWBB+Yds1LtIW29qGbYStzTf5k417wzFN9jhv5itLx8huDpCATFi+h7wGJzXfFgzC W9cF2bYwJyKYCaj6hUV5Edt9GrQGiC1pNCoBParYCdgrFsojSct7BYrPy2zHwrT6UGat 2h9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UDcUjMP0; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-173824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628ea7885si2069907a91.88.2024.05.08.14.05.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 14:05:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UDcUjMP0; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-173824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7204FB22E61 for ; Wed, 8 May 2024 21:05:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A32B3131BA5; Wed, 8 May 2024 21:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UDcUjMP0" Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AFB1131748 for ; Wed, 8 May 2024 21:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715202312; cv=none; b=HoBVua02Umyu/7sX5Tf7i9nhiEGYtUuFI2U++rFozV88D/yfOj0QvvsHE3jM0tR6flLM0mQCQ1GYvFRD4cv/2dNsYrTnprrIvHxpUPg8t2Nm10spQdeMMPL22slWensx2eKlrsXXfLGxVGdqTvMwk2hQlEca9+TfRc1ifH1bIb4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715202312; c=relaxed/simple; bh=acPOrt5ygOuLSWdIDxURBep5aeWaEbWmyC8ArTfUIzc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aeMv9SwtoDcCycIUs+sPORZOqFIkoDlkprUfwoR9anfdjkFjsvPomsNusNqnsiA3S66zyp3jEK4bWjCbsbUYGIAMbrMdSJGHhJ62jwvM4mpVa9/c1VHS/LxRoxoGVdO1MyomXTiYuKlFz+07p/I/q/vXgOoCsft5G9EgZP57X54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UDcUjMP0; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-43d55133609so27271cf.1 for ; Wed, 08 May 2024 14:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715202310; x=1715807110; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TacJSNF5BN2EAxFL9AKWhV4ZHViuaAA6IA2uXpBpZ4A=; b=UDcUjMP059S0qfM8G0gPAy0b6NzzBjUSPK9O4x/hS2yTDamtlet9OEsRRdvhk3FmEq 3yQlh2UEMHQj+VktSu1KtOJAWCDPOAqppk9+MYj3VYYIrvXf+JpEDp72HPT+wH7uFq/t Lfir/poV2aZp/tNF4qINkQUO9R8nVDQlSbCJ6/MLTkVAkfz8YZxTqE36PKZEFT3ky2Ny xFuPxEpkmjt1wlLi4/9Atjxz8tvq1nPsfuPc9a6Prl4HpeD0df9H4fk+hTRTSRgM5bwI /SxTZp7qjsoB/lHqz3r62E3dgbeCCheyYQAzvwHAMYzfYxwLDGW8vuZW0dqviEp1usGg CGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715202310; x=1715807110; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TacJSNF5BN2EAxFL9AKWhV4ZHViuaAA6IA2uXpBpZ4A=; b=jZY4Jd8CPUD9lW/zRK9Shwh129ojNfWruE619xwU50SIPhcg7UvVPLwhIuh+HYlypo N5S/aU0tULelTPulKG65iH5aToVz8jDZ98StnGps9mzit4sBNZtwbqVG0RFr5MLC6bGw 9B0opN1h0bbjcu3k0xPFi9hYgEx2PAoXSugCMEIPu6Fr9Nn1RvGMZYZWoIxxqI2BJ9UP mAuZWep06YlklNBKGXFgpIeUyZSXEDDaos5Jejmo/qcdOelUEbqBo8MqgeXhg/2W/3MI KJA8sqIC+Hx6rC5Nb+Stw7rEmkmK5uCsMwjiscpzEXNympQGs88I3k7JNmS0fLigdMfs MvTA== X-Forwarded-Encrypted: i=1; AJvYcCXnEMguPxjp84NjJhXttQcNh159/juht4luWDUk+vqimpvq3+Se+f/ihmmPPRLhtx6z2XhhFBFnpJTE5WEi7IGuLTm4z1a6VcpPz7tW X-Gm-Message-State: AOJu0YyruKCqhaeaoIsP1NqYmO90m73Aa0LFZiffsuw2SRk/1w1Wk4a8 u1SbpO0F2P9JbASoRA7No77NIyLGmWFy/qj0WAzyLntmKiQlH36MtE7rvhR1O5ohcgswE4M65iM sAuZX/o/I9fNbT3ITtATJ5XyUvanc1AdiRIVp X-Received: by 2002:ac8:6f1b:0:b0:43c:de95:6258 with SMTP id d75a77b69052e-43defba092bmr1126521cf.18.1715202309981; Wed, 08 May 2024 14:05:09 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240508141458.439017-1-james.clark@arm.com> In-Reply-To: <20240508141458.439017-1-james.clark@arm.com> From: Ian Rogers Date: Wed, 8 May 2024 14:04:58 -0700 Message-ID: Subject: Re: [PATCH] perf dwarf-aux: Fix build with HAVE_DWARF_CFI_SUPPORT To: James Clark Cc: linux-perf-users@vger.kernel.org, leo.yan@linux.dev, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Masami Hiramatsu , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 8, 2024 at 7:15=E2=80=AFAM James Clark wr= ote: > > 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=3Darm64 CROSS_COMPILE=3Daarch64-linux-gnu- LDFLAGS=3D"-stat= ic" \ > EXTRA_PERFLIBS=3D"-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 Reviewed-by: Ian Rogers (eye-balled to see the #if problem exists and this is the correct fix) Thanks, Ian > --- > 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 th= e given > + * register and offset exactly. Thus it rejects any complex expr= essions > + * and only allows a few of selected operators that doesn't chang= e 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, s= truct 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 th= e given > - * register and offset exactly. Thus it rejects any complex expr= essions > - * and only allows a few of selected operators that doesn't chang= e 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 >