backport patches to linux-5.4.y

Anders Roxell
2021-04-13T12:12:10Z

Hi,

Can these patches be backported to linux-5.4.y, I've tried to build
perf on arm and it failed without these patches.
fc8c0a992233 ("perf tools: Use %define api.pure full instead of %pure-parser")
20befbb10803 ("perf tools: Use %zd for size_t printf formats on 32-bit")
77d02bd00cea ("perf map: Tighten snprintf() string precision to pass
gcc check on some 32-bit arches")

Commit fc8c0a992233 ("perf tools: Use %define api.pure full instead of
%pure-parser") fixes:

util/parse-events.y:1.1-12: warning: deprecated directive:
'%pure-parser', use '%define api.pure' [-Wdeprecated]
1 | %pure-parser
| ^~~~~~~~~~~~
| %define api.pure

Commit 20befbb10803 ("perf tools: Use %zd for size_t printf formats on
32-bit") fixes:

In file included from util/session.c:17:
util/session.c: In function 'perf_session__process_compressed_event':
util/session.c:91:11: error: format '%ld' expects argument of type
'long int', but argument 4 has type 'size_t' {aka 'unsigned int'}
[-Werror=format=]
91 | pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
util/debug.h:16:21: note: in definition of macro 'pr_fmt'
16 | #define pr_fmt(fmt) fmt
| ^~~
util/session.c:91:2: note: in expansion of macro 'pr_debug'
91 | pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
| ^~~~~~~~

Commit 77d02bd00cea ("perf map: Tighten snprintf() string precision to
pass gcc check on some 32-bit arches") fixes:

util/map.c: In function 'map__new':
util/map.c:125:5: error: '%s' directive output may be truncated
writing between 1 and 2147483645 bytes into a region of size 4096
[-Werror=format-truncation=]
125 | "%s/platforms/%s/arch-%s/usr/lib/%s",
| ^~
In file included from /usr/arm-linux-gnueabihf/include/stdio.h:867,
from util/symbol.h:11,
from util/map.c:2:
/usr/arm-linux-gnueabihf/include/bits/stdio2.h:67:10: note:
'__builtin___snprintf_chk' output 32 or more bytes (assuming
4294967321) into a destination of size 4096
67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cheers,
Anders