• Jianlin Lv's avatar
    perf tools: Fix arm64 build error with gcc-11 · 06701297
    Jianlin Lv authored
    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:100: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: default avatarJianlin Lv <Jianlin.Lv@arm.com>
    Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
    Acked-by: default avatarJiri 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    06701297
perf_regs.h 2.54 KB