Commit 07b972ff authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf disasm: Don't include C files from the arch directory



Move the arch instructions.c files into appropriately named files in
annotate-arch in the util directory.

Don't #include to compile the code, switch to building the files and fix
up the #includes accordingly.

Move powerpc specific disasm code out of disasm.c and into
annotate-powerpc.c.

Declarations and static removed as appropriate for the code to compile
as separate compilation units.

The e_machine and e_flags set up is moved to the disasm.c architectures
array so that later patches can sort by them.

Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zecheng Li <zecheng@google.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 92730852
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
include $(srctree)/tools/scripts/Makefile.include
include $(srctree)/tools/scripts/utilities.mak

perf-util-y += annotate-arch/
perf-util-y += arm64-frame-pointer-unwind-support.o
perf-util-y += addr2line.o
perf-util-y += addr_location.o
+11 −0
Original line number Diff line number Diff line
perf-util-y += annotate-arc.o
perf-util-y += annotate-arm.o
perf-util-y += annotate-arm64.o
perf-util-y += annotate-csky.o
perf-util-y += annotate-loongarch.o
perf-util-y += annotate-mips.o
perf-util-y += annotate-x86.o
perf-util-y += annotate-powerpc.o
perf-util-y += annotate-riscv64.o
perf-util-y += annotate-s390.o
perf-util-y += annotate-sparc.o
+2 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <linux/compiler.h>
#include "../disasm.h"

static int arc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
int arc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{
	arch->initialized = true;
	arch->objdump.comment_char = ';';
	arch->e_machine = EM_ARC;
	arch->e_flags = 0;
	return 0;
}
+4 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <stdlib.h>
#include <linux/compiler.h>
#include <linux/zalloc.h>
#include <errno.h>
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include "../annotate.h"
#include "../disasm.h"

struct arm_annotate {
	regex_t call_insn,
@@ -28,7 +29,7 @@ static const struct ins_ops *arm__associate_instruction_ops(struct arch *arch, c
	return ops;
}

static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{
	struct arm_annotate *arm;
	int err;
@@ -54,8 +55,6 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
	arch->associate_instruction_ops   = arm__associate_instruction_ops;
	arch->objdump.comment_char	  = ';';
	arch->objdump.skip_functions_char = '+';
	arch->e_machine = EM_ARM;
	arch->e_flags = 0;
	return 0;

out_free_call:
+6 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <linux/compiler.h>
#include <errno.h>
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <string.h>
#include <linux/zalloc.h>
#include <regex.h>
#include "../annotate.h"
#include "../disasm.h"

struct arm64_annotate {
	regex_t call_insn,
@@ -60,9 +63,6 @@ static int arm64_mov__parse(const struct arch *arch __maybe_unused,
	return -1;
}

static int mov__scnprintf(const struct ins *ins, char *bf, size_t size,
			  struct ins_operands *ops, int max_ins_name);

static const struct ins_ops arm64_mov_ops = {
	.parse	   = arm64_mov__parse,
	.scnprintf = mov__scnprintf,
@@ -87,7 +87,7 @@ static const struct ins_ops *arm64__associate_instruction_ops(struct arch *arch,
	return ops;
}

static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{
	struct arm64_annotate *arm;
	int err;
@@ -114,8 +114,6 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
	arch->associate_instruction_ops   = arm64__associate_instruction_ops;
	arch->objdump.comment_char	  = '/';
	arch->objdump.skip_functions_char = '+';
	arch->e_machine = EM_AARCH64;
	arch->e_flags = 0;
	return 0;

out_free_call:
Loading