Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1216719

[PATCH] perf record: fix link time error with sample_reg_masks on non x86

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Stephane Eranian <eranian@google.com>
Newsgroups linux.kernel
Subject [PATCH] perf record: fix link time error with sample_reg_masks on non x86
Date Tue, 01 Sep 2015 11:40:02 +0200
Message-ID <q3QcO-2CC-9@gated-at.bofh.it> (permalink)
X-Original-To linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2PXF/OUkILPDyRq4FwweL99Lrufkw9PmqONp+bDhBlE=; b=T7+gv5nJkW3D+iI6GmXEKlv2U/KJjNEyTm6ANf1+2YDPy+2IeQMkXo7wtYHCx/+REW +ZFHFR4LwEBWCMDQCQyrlZzFZTurmXBhPloFuuxmNcKVCspG5WT5XPXdyTvQDCX+NP7B 0gjuIrBteodkgNvgBLlZLa6suoZSy5/5oo7miVAeFUPRzSjEHZCMiilNJjrNX0/xcH9g JWLnwpHXwtYOFx5PswHScixD584iFO8W8izrefsAq7/7tcsGFlTkhZrJzGhB1jBiDugX ViB6l6juB1w72kTzOMD8TzstSdIl8C8x3mmuzckgfaT68TNuhlpHXk4GnpnLLoRxuP2P 7CJw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2PXF/OUkILPDyRq4FwweL99Lrufkw9PmqONp+bDhBlE=; b=NbJbwnPZ92LBonMICarUsjaQpkYbnQ18nEeo+23EKkqB78x6K/iOd0adPkIHGs4/S1 PX6SerEq1BWCgozHwxwrA89c33XkHdcx1xNcmaj5C/QtoL3Wptc/5H6nfxJYcj3QfgQq 1gvWUOoEMTw7dRLmeShB2XOUXydquQttTR38548Mg+0rgj/GvBSJwcp+rCqoh8EBrRsF 4/Zovo5QQUDA5v8kJbuN2//lhGVYTaFC4tylU8ZKtbG1mGS9gmpm7VRZ303xUAZZxlJQ ViM3vycyC1zEZrOdTcNbfTrKW69naidBYs5LgX5QtAG5EBhj0lil+r1w15YKo5G+f1Iy WChQ==
X-Gm-Message-State ALoCoQnhTJYtDMeDSHtw/UmZwhz3Ed0QZAiY2vlXcnXwzv0I5lRlW09SHfxi37IIFBUoULIUcILS
X-Received by 10.194.235.169 with SMTP id un9mr31724071wjc.136.1441099820553; Tue, 01 Sep 2015 02:30:20 -0700 (PDT)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 106
Organization linux.* mail to news gateway
X-Original-Cc acme@redhat.com, peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, kan.liang@intel.com, dsahern@gmail.com, adrian.hunter@intel.com
X-Original-Date Tue, 1 Sep 2015 11:30:14 +0200
X-Original-Message-ID <1441099814-26783-1-git-send-email-eranian@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1216719

Show key headers only | View raw


This patch makes perf compile on non x86 platforms by defining
a weak symbol for sample_reg_masks[] in util/perf_regs.c.

The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.

Signed-off-by: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/x86/util/perf_regs.c | 44 +++++++++++++++++-------------------
 tools/perf/util/perf_regs.c          |  4 ++++
 tools/perf/util/perf_regs.h          |  2 ++
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c
index 087c84e..c5db14f 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -1,30 +1,28 @@
 #include "../../perf.h"
 #include "../../util/perf_regs.h"
 
-#define REG(n, b) { .name = #n, .mask = 1ULL << (b) }
-#define REG_END { .name = NULL }
 const struct sample_reg sample_reg_masks[] = {
-	REG(AX, PERF_REG_X86_AX),
-	REG(BX, PERF_REG_X86_BX),
-	REG(CX, PERF_REG_X86_CX),
-	REG(DX, PERF_REG_X86_DX),
-	REG(SI, PERF_REG_X86_SI),
-	REG(DI, PERF_REG_X86_DI),
-	REG(BP, PERF_REG_X86_BP),
-	REG(SP, PERF_REG_X86_SP),
-	REG(IP, PERF_REG_X86_IP),
-	REG(FLAGS, PERF_REG_X86_FLAGS),
-	REG(CS, PERF_REG_X86_CS),
-	REG(SS, PERF_REG_X86_SS),
+	SMPL_REG(AX, PERF_REG_X86_AX),
+	SMPL_REG(BX, PERF_REG_X86_BX),
+	SMPL_REG(CX, PERF_REG_X86_CX),
+	SMPL_REG(DX, PERF_REG_X86_DX),
+	SMPL_REG(SI, PERF_REG_X86_SI),
+	SMPL_REG(DI, PERF_REG_X86_DI),
+	SMPL_REG(BP, PERF_REG_X86_BP),
+	SMPL_REG(SP, PERF_REG_X86_SP),
+	SMPL_REG(IP, PERF_REG_X86_IP),
+	SMPL_REG(FLAGS, PERF_REG_X86_FLAGS),
+	SMPL_REG(CS, PERF_REG_X86_CS),
+	SMPL_REG(SS, PERF_REG_X86_SS),
 #ifdef HAVE_ARCH_X86_64_SUPPORT
-	REG(R8, PERF_REG_X86_R8),
-	REG(R9, PERF_REG_X86_R9),
-	REG(R10, PERF_REG_X86_R10),
-	REG(R11, PERF_REG_X86_R11),
-	REG(R12, PERF_REG_X86_R12),
-	REG(R13, PERF_REG_X86_R13),
-	REG(R14, PERF_REG_X86_R14),
-	REG(R15, PERF_REG_X86_R15),
+	SMPL_REG(R8, PERF_REG_X86_R8),
+	SMPL_REG(R9, PERF_REG_X86_R9),
+	SMPL_REG(R10, PERF_REG_X86_R10),
+	SMPL_REG(R11, PERF_REG_X86_R11),
+	SMPL_REG(R12, PERF_REG_X86_R12),
+	SMPL_REG(R13, PERF_REG_X86_R13),
+	SMPL_REG(R14, PERF_REG_X86_R14),
+	SMPL_REG(R15, PERF_REG_X86_R15),
 #endif
-	REG_END
+	SMPL_REG_END
 };
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..885e8ac 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -2,6 +2,10 @@
 #include "perf_regs.h"
 #include "event.h"
 
+const struct sample_reg __weak sample_reg_masks[] = {
+	SMPL_REG_END
+};
+
 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
 {
 	int i, idx = 0;
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 92c1fff..2984dcc 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -9,6 +9,8 @@ struct sample_reg {
 	const char *name;
 	uint64_t mask;
 };
+#define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
+#define SMPL_REG_END { .name = NULL }
 
 extern const struct sample_reg sample_reg_masks[];
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf record: fix link time error with sample_reg_masks on non x86 Stephane Eranian <eranian@google.com> - 2015-09-01 11:40 +0200
  Re: [PATCH] perf record: fix link time error with sample_reg_masks  on non x86 Jiri Olsa <jolsa@redhat.com> - 2015-09-01 12:00 +0200
  [tip:perf/urgent] perf tools:   Fix link time error with sample_reg_masks on non x86 tip-bot for Stephane Eranian <tipbot@zytor.com> - 2015-09-02 09:30 +0200
  Re: [PATCH] perf record: fix link time error with sample_reg_masks on  non x86 Adrian Hunter <adrian.hunter@intel.com> - 2015-09-02 11:50 +0200

csiph-web