mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
gcc version: 11.0.0 20210208 (experimental) (GCC)
Following build error on arm64:
.......
In function ‘printf’,
inlined from ‘regs_dump__printf’ at util/session.c:1141:3,
inlined from ‘regs__printf’ at util/session.c:1169:2:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:107:10: \
error: ‘%-5s’ directive argument is null [-Werror=format-overflow=]
107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, \
__va_arg_pack ());
......
In function ‘fprintf’,
inlined from ‘perf_sample__fprintf_regs.isra’ at \
builtin-script.c:622:14:
/usr/include/aarch64-linux-gnu/bits/stdio2.h💯10: \
error: ‘%5s’ directive argument is null [-Werror=format-overflow=]
100 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
101 | __va_arg_pack ());
cc1: all warnings being treated as errors
.......
This patch fixes Wformat-overflow warnings. Add helper function to
convert NULL to "unknown".
Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: iecedge@gmail.com
Cc: linux-csky@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Link: http://lore.kernel.org/lkml/20210218031245.2078492-1-Jianlin.Lv@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
109 lines
2.1 KiB
C
109 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef ARCH_PERF_REGS_H
|
|
#define ARCH_PERF_REGS_H
|
|
|
|
#include <stdlib.h>
|
|
#include <linux/types.h>
|
|
#include <asm/perf_regs.h>
|
|
|
|
void perf_regs_load(u64 *regs);
|
|
|
|
#define PERF_REGS_MAX PERF_REG_X86_XMM_MAX
|
|
#ifndef HAVE_ARCH_X86_64_SUPPORT
|
|
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
|
|
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
|
|
#else
|
|
#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
|
|
(1ULL << PERF_REG_X86_ES) | \
|
|
(1ULL << PERF_REG_X86_FS) | \
|
|
(1ULL << PERF_REG_X86_GS))
|
|
#define PERF_REGS_MASK (((1ULL << PERF_REG_X86_64_MAX) - 1) & ~REG_NOSUPPORT)
|
|
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
|
|
#endif
|
|
#define PERF_REG_IP PERF_REG_X86_IP
|
|
#define PERF_REG_SP PERF_REG_X86_SP
|
|
|
|
static inline const char *__perf_reg_name(int id)
|
|
{
|
|
switch (id) {
|
|
case PERF_REG_X86_AX:
|
|
return "AX";
|
|
case PERF_REG_X86_BX:
|
|
return "BX";
|
|
case PERF_REG_X86_CX:
|
|
return "CX";
|
|
case PERF_REG_X86_DX:
|
|
return "DX";
|
|
case PERF_REG_X86_SI:
|
|
return "SI";
|
|
case PERF_REG_X86_DI:
|
|
return "DI";
|
|
case PERF_REG_X86_BP:
|
|
return "BP";
|
|
case PERF_REG_X86_SP:
|
|
return "SP";
|
|
case PERF_REG_X86_IP:
|
|
return "IP";
|
|
case PERF_REG_X86_FLAGS:
|
|
return "FLAGS";
|
|
case PERF_REG_X86_CS:
|
|
return "CS";
|
|
case PERF_REG_X86_SS:
|
|
return "SS";
|
|
case PERF_REG_X86_DS:
|
|
return "DS";
|
|
case PERF_REG_X86_ES:
|
|
return "ES";
|
|
case PERF_REG_X86_FS:
|
|
return "FS";
|
|
case PERF_REG_X86_GS:
|
|
return "GS";
|
|
#ifdef HAVE_ARCH_X86_64_SUPPORT
|
|
case PERF_REG_X86_R8:
|
|
return "R8";
|
|
case PERF_REG_X86_R9:
|
|
return "R9";
|
|
case PERF_REG_X86_R10:
|
|
return "R10";
|
|
case PERF_REG_X86_R11:
|
|
return "R11";
|
|
case PERF_REG_X86_R12:
|
|
return "R12";
|
|
case PERF_REG_X86_R13:
|
|
return "R13";
|
|
case PERF_REG_X86_R14:
|
|
return "R14";
|
|
case PERF_REG_X86_R15:
|
|
return "R15";
|
|
#endif /* HAVE_ARCH_X86_64_SUPPORT */
|
|
|
|
#define XMM(x) \
|
|
case PERF_REG_X86_XMM ## x: \
|
|
case PERF_REG_X86_XMM ## x + 1: \
|
|
return "XMM" #x;
|
|
XMM(0)
|
|
XMM(1)
|
|
XMM(2)
|
|
XMM(3)
|
|
XMM(4)
|
|
XMM(5)
|
|
XMM(6)
|
|
XMM(7)
|
|
XMM(8)
|
|
XMM(9)
|
|
XMM(10)
|
|
XMM(11)
|
|
XMM(12)
|
|
XMM(13)
|
|
XMM(14)
|
|
XMM(15)
|
|
#undef XMM
|
|
default:
|
|
return NULL;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* ARCH_PERF_REGS_H */
|