From nobody Thu Nov 28 03:32:39 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 E9F2F187FF5 for ; Sat, 5 Oct 2024 19:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158205; cv=none; b=At5d1128J9ne0ZOwAm2pWtCWC3yGehMfbj5IlmWYP8uSSa4bnIdqWOh9XhuBmSMB35LipckUWqBJcmvHCfC+aEQXygjStUs10xaCfTjoojZdyuEOw6fAY24JkseD2vWR4fB538dgr3JgXMR7Ej7ffoXV03s5GA5IsPfpnVTUiKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158205; c=relaxed/simple; bh=kXNwRqhYw2oyTtE92Hlo7PIb68o0Ad18nbAfRGxWq8w=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=cs7fdPR9URFzpr1C8omFIFQZSCBDA5wuxDy11A2egarmbAwl26Zhn4X420kco1T1f5laJbFKQQeRvBlYpNiBMxfBBUXJxPQXBe+BVeXDXKEOe+vJ7I9O2cYEB4Ov5Swr9Z5Y8zm7EVd6OunsQdOKXptQ5jk2+y9ynKh7oPdHfsM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=c8mZptUz; arc=none smtp.client-ip=209.85.128.202 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=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c8mZptUz" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e230808455so40287307b3.0 for ; Sat, 05 Oct 2024 12:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158203; x=1728763003; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VHudwD3HxqIE2xCZ8D7KanMs36PPvPHIODUgdbqENmk=; b=c8mZptUz8k/TX5vlvI9UcF5EEhGcbwnABL7Y44WzFu+EDMJUpfhzmm0xySu9y/DEx3 lcMZnpJdQqj4qwGiQwPrcJ5cnHmxQoWb0r99gnv7xvC91h+sqPN+XMT39L57YF0/dHY/ cD6HqH4eGBZG1+uQ48VP32nG2Zibu4amAnzWcRhQINP1OA6vEd1AdF3YsIbzotFG29GM JblywqiJEIzsemHr0VBbgUYb87l7tbc1z2AlGC2sHMzGxjZUCdICY97I8/nM2Gnl0f5j ej8/lPcDKvSRtH4oLqyz2sHQhuivu7wDnEZ2BtBcOwPOgY5SOuUApgYCRK1aJu1fQVN5 jbvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158203; x=1728763003; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VHudwD3HxqIE2xCZ8D7KanMs36PPvPHIODUgdbqENmk=; b=W4wwcphyRSjvnF/cQPuIxGw/uZA13k9mNU2qaN1hpOG1XJh7wthWCGauuqGJkywoYj S7524xDnyXm3LMAn2KO3w8G5TtVkfRcG1K5+naMilm/cd50mAIqys0bAA0FJC3yxOYuJ sCVg0V7Jk/I/3D2vgPffvrtWAcgfU5nae83Me111cTzM4UPsasfjfV8u6naOjcxKzESM ZLFR5TZ8D/zknqrGxkyUmolQQK1lKGzKijrTKJMVkr79L/tsnkxC2PXNznuONIml919t CpGfzb+WmiNz27jvoqnUwureEueZGLlYRBzRY0clBgCLV66j/obD4VR+hvODNUcIdbPU OUpA== X-Forwarded-Encrypted: i=1; AJvYcCVz5ustL4Y+fIRQWLHj2eW0LyjWPUPVTXR+w4GDnF5E9MKbEXrVHVwUd17gtDLxMx3e8TUqvZabVcoTkXI=@vger.kernel.org X-Gm-Message-State: AOJu0YyTE093L5aHscZWmk6xGK7u2YJiPigsNjJXQKvJyEuvt2BsRaaU qDzT6xcLNGfdAdwVcxg6VLbDqXX37Mn6SNA2JVqMesPWA8deaaGH7dh4r2Jd97oVwTMQplpOyzZ +KiCAmA== X-Google-Smtp-Source: AGHT+IGeOfTmumngcabHRBihmvSKyViFpRQ89UdAfehUtwMJwCeL6FioC5a/4B+7LmCwWalq3BF9Zy/Nx0rQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:61c8:b0:6e2:e462:e191 with SMTP id 00721157ae682-6e2e462e214mr604667b3.6.1728158203030; Sat, 05 Oct 2024 12:56:43 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:30 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-21-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 20/31] perf arm: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/dwarf-regs.c | 61 --------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 tools/perf/arch/arm/util/dwarf-regs.c diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index e06fea1ea8ff..f7a8b37d1c68 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,7 +1,5 @@ perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/ut= il/dwarf-regs.c deleted file mode 100644 index fc5f71c91802..000000000000 --- a/tools/perf/arch/arm/util/dwarf-regs.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%r##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadw= arf.pdf - */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - REG_DWARFNUM_NAME("%fp", 11), - REG_DWARFNUM_NAME("%ip", 12), - REG_DWARFNUM_NAME("%sp", 13), - REG_DWARFNUM_NAME("%lr", 14), - REG_DWARFNUM_NAME("%pc", 15), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct pt_regs_dwarfnum *roff; - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 18e916c8e993..fd21f9e90e40 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index e640657f69c8..0b533409d82a 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog