From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27868C001E0 for ; Mon, 23 Oct 2023 16:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbjJWQiH (ORCPT ); Mon, 23 Oct 2023 12:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232700AbjJWQiF (ORCPT ); Mon, 23 Oct 2023 12:38:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7CA092; Mon, 23 Oct 2023 09:38:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50FE5C433C8; Mon, 23 Oct 2023 16:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698079083; bh=PmOhABY1//m3uavFWKiIgtRvu0OAYB3NtnB3wb/zXec=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MMQB6N3We8yFL61X4/+4r1DmfCP5DVsh4WUc1JRt14fBnvyxBucsSjWuVYlGHk5PU OHx0RUYcwov1cWggrLP7+agpgmMKqwqIsbN/1jETwdwdgPCsrgx5k74/Dbr+agyq8H RRHE70vUXdgkPcFsWZIgeIWuoaEU2D8oC7dW4hWPStU3EIbQGzLlBjKROBl0pk6Ttv xAVIyExIW0tXvWzqej4JppEE4IL8W846Fa7nQ+KaHuZ5Z2SjkWZt0TaqmJZN6ynav7 JhO5LnljaLZ07568GEGw5U/tpxe/n2zNIrxm/PeaK8cl7Xk8CzThQqiHy0z4Veoda4 9b2ow8ltNlPYg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 717D44035D; Mon, 23 Oct 2023 13:38:00 -0300 (-03) Date: Mon, 23 Oct 2023 13:38:00 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Peter Zijlstra , Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH 13/48] perf annotate: Add annotate_get_insn_location() Message-ID: References: <20231012035111.676789-1-namhyung@kernel.org> <20231012035111.676789-14-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012035111.676789-14-namhyung@kernel.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org Em Wed, Oct 11, 2023 at 08:50:36PM -0700, Namhyung Kim escreveu: > The annotate_get_insn_location() is to get the detailed information of > instruction locations like registers and offset. It has source and > target operands locations in an array. Each operand can have a > register and an offset. The offset is meaningful when mem_ref flag is > set. This needs to be enclosed in HAVE_DWARF_SUPPORT, as the build is failing in systems where this isn't available, see patch below. CC /tmp/build/perf/arch/x86/util/pmu.o util/annotate.c: In function 'extract_reg_offset': util/annotate.c:3537:24: error: implicit declaration of function 'get_dwarf_regnum' [-Werror=implicit-function-declaration] 3537 | op_loc->reg1 = get_dwarf_regnum(regname, 0); | ^~~~~~~~~~~~~~~~ CC /tmp/build/perf/tests/vmlinux-kallsyms.o I tested it with 'make NO_DWARF=1' - Arnaldo diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 9d653a1e84ce4889..b998c81c89be04fc 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -3486,6 +3486,7 @@ int annotate_check_args(struct annotation_options *args) return 0; } +#ifdef HAVE_DWARF_SUPPORT /* * Get register number and access offset from the given instruction. * It assumes AT&T x86 asm format like OFFSET(REG). Maybe it needs @@ -3591,3 +3592,4 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, return 0; } +#endif // HAVE_DWARF_SUPPORT diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 4adda492233d2742..484be346a279c481 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -437,6 +437,7 @@ int annotate_parse_percent_type(const struct option *opt, const char *_str, int annotate_check_args(struct annotation_options *args); +#ifdef HAVE_DWARF_SUPPORT /** * struct annotated_op_loc - Location info of instruction operand * @reg: Register in the operand @@ -473,4 +474,5 @@ struct annotated_insn_loc { int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, struct annotated_insn_loc *loc); +#endif /* HAVE_DWARF_SUPPORT */ #endif /* __PERF_ANNOTATE_H */