[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190826224136.GD21761@kernel.org>
Date: Mon, 26 Aug 2019 19:41:36 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>
Subject: Re: [PATCH 00/12] libperf: Add events to perf/event.h
Em Mon, Aug 26, 2019 at 07:14:19PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
> > On Mon, Aug 26, 2019 at 01:18:49PM -0300, Arnaldo Carvalho de Melo wrote:
> >
> > SNIP
> >
> > > [perfbuilder@...c2c7bdaab ~]$ grep 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > [perfbuilder@...c2c7bdaab ~]$
> > >
> > > And if we do this on a fedora:30 x86_64:
> > >
> > > $ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i
> > > [acme@...co perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > printf("lost %" "l"
> > > # 2646 "builtin-sched.c" 3 4
> > > "l" "u"
> > > # 2646 "builtin-sched.c"
> > > " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > [acme@...co perf]$
> > >
> > > I.e. on 32-bit arches we shouldn't add that extra "l", right?
> >
> > hum, I guess we could #ifdef it 64/32 bits
>
> I tried to figure out how to fix this better, but the int-ll64.h versus
> int-l64.h versus how __u64 is defined got me confused and I ended up
> with:
>
> #if __WORDSIZE == 64
Make that:
#ifdef __LP64__ to build on Alpine/musl libc.
- Arnaldo
> /*
> * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
> * __u64 as long long unsigned int, and then -Werror=format= kicks in and
> * complains of the mismatched types, so use these two special extra PRI
> * macros to overcome that.
> */
> #define PRI_lu64 "l" PRIu64
> #define PRI_lx64 "l" PRIx64
> #else
> #define PRI_lu64 PRIu64
> #define PRI_lx64 PRIx64
> #endif
>
> Builds in all the containers I have, 32-bit, 64-bit, old gccs/clangs,
> new ones, uclibc, musl libc, glibc, etc
>
> > >
> > > I bet the build for the mips/mipsel will fail too, lemme see... Yeah,
> > > both failed:
> > >
> > >
> >> [root@...co ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:
> > > /usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@...co ~]#
> > >
> > > [root@...co ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:
> > > /usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@...co ~]#
> > >
> > > And also on a uclibc ARC arch container:
> > >
> > > [root@...co ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:0:
> > > /arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@...co ~]#
> > >
> > > The _fix_ will come after lunch :)
> >
> > thanks ;-)
> >
> > jirka
>
> --
>
> - Arnaldo
--
- Arnaldo
Powered by blists - more mailing lists