mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02: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>
97 lines
1.9 KiB
C
97 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */
|
|
|
|
#ifndef ARCH_PERF_REGS_H
|
|
#define ARCH_PERF_REGS_H
|
|
|
|
#include <stdlib.h>
|
|
#include <linux/types.h>
|
|
#include <asm/perf_regs.h>
|
|
|
|
#define PERF_REGS_MASK ((1ULL << PERF_REG_RISCV_MAX) - 1)
|
|
#define PERF_REGS_MAX PERF_REG_RISCV_MAX
|
|
#if __riscv_xlen == 64
|
|
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
|
|
#else
|
|
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
|
|
#endif
|
|
|
|
#define PERF_REG_IP PERF_REG_RISCV_PC
|
|
#define PERF_REG_SP PERF_REG_RISCV_SP
|
|
|
|
static inline const char *__perf_reg_name(int id)
|
|
{
|
|
switch (id) {
|
|
case PERF_REG_RISCV_PC:
|
|
return "pc";
|
|
case PERF_REG_RISCV_RA:
|
|
return "ra";
|
|
case PERF_REG_RISCV_SP:
|
|
return "sp";
|
|
case PERF_REG_RISCV_GP:
|
|
return "gp";
|
|
case PERF_REG_RISCV_TP:
|
|
return "tp";
|
|
case PERF_REG_RISCV_T0:
|
|
return "t0";
|
|
case PERF_REG_RISCV_T1:
|
|
return "t1";
|
|
case PERF_REG_RISCV_T2:
|
|
return "t2";
|
|
case PERF_REG_RISCV_S0:
|
|
return "s0";
|
|
case PERF_REG_RISCV_S1:
|
|
return "s1";
|
|
case PERF_REG_RISCV_A0:
|
|
return "a0";
|
|
case PERF_REG_RISCV_A1:
|
|
return "a1";
|
|
case PERF_REG_RISCV_A2:
|
|
return "a2";
|
|
case PERF_REG_RISCV_A3:
|
|
return "a3";
|
|
case PERF_REG_RISCV_A4:
|
|
return "a4";
|
|
case PERF_REG_RISCV_A5:
|
|
return "a5";
|
|
case PERF_REG_RISCV_A6:
|
|
return "a6";
|
|
case PERF_REG_RISCV_A7:
|
|
return "a7";
|
|
case PERF_REG_RISCV_S2:
|
|
return "s2";
|
|
case PERF_REG_RISCV_S3:
|
|
return "s3";
|
|
case PERF_REG_RISCV_S4:
|
|
return "s4";
|
|
case PERF_REG_RISCV_S5:
|
|
return "s5";
|
|
case PERF_REG_RISCV_S6:
|
|
return "s6";
|
|
case PERF_REG_RISCV_S7:
|
|
return "s7";
|
|
case PERF_REG_RISCV_S8:
|
|
return "s8";
|
|
case PERF_REG_RISCV_S9:
|
|
return "s9";
|
|
case PERF_REG_RISCV_S10:
|
|
return "s10";
|
|
case PERF_REG_RISCV_S11:
|
|
return "s11";
|
|
case PERF_REG_RISCV_T3:
|
|
return "t3";
|
|
case PERF_REG_RISCV_T4:
|
|
return "t4";
|
|
case PERF_REG_RISCV_T5:
|
|
return "t5";
|
|
case PERF_REG_RISCV_T6:
|
|
return "t6";
|
|
default:
|
|
return NULL;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* ARCH_PERF_REGS_H */
|