public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Michael Petlan <mpetlan@redhat.com>,
	Ian Rogers <irogers@google.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf tools: Fix compilation on powerpc
Date: Tue, 28 Sep 2021 22:39:05 +0200	[thread overview]
Message-ID: <YVN9aZsIRYrhT1mU@wildebeest.org> (raw)
In-Reply-To: <20210928195253.1267023-1-jolsa@kernel.org>

Hi,

On Tue, Sep 28, 2021 at 09:52:53PM +0200, Jiri Olsa wrote:
> Got following build fail on powerpc:
> 
>     CC      arch/powerpc/util/skip-callchain-idx.o
>   In function ‘check_return_reg’,
>       inlined from ‘check_return_addr’ at arch/powerpc/util/skip-callchain-idx.c:213:7,
>       inlined from ‘arch_skip_callchain_idx’ at arch/powerpc/util/skip-callchain-idx.c:265:7:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: error: ‘dwarf_frame_register’ accessing 96 bytes \
>   in a region of size 64 [-Werror=stringop-overflow=]
>      54 |         result = dwarf_frame_register(frame, ra_regno, ops_mem, &ops, &nops);
>         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/powerpc/util/skip-callchain-idx.c: In function ‘arch_skip_callchain_idx’:
>   arch/powerpc/util/skip-callchain-idx.c:54:18: note: referencing argument 3 of type ‘Dwarf_Op *’
>   In file included from /usr/include/elfutils/libdwfl.h:32,
>                    from arch/powerpc/util/skip-callchain-idx.c:10:
>   /usr/include/elfutils/libdw.h:1069:12: note: in a call to function ‘dwarf_frame_register’
>    1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
>         |            ^~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
> 
> The dwarf_frame_register args changed with [1],
> Updating ops_mem accordingly.
> 
> [1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=5621fe5443da23112170235dd5cac161e5c75e65

The warning (new with GCC11) and the fix are correct.

The code probably worked fine before because the next var on the stack
was the dummy Dwarf_Op which would have been as if the ops_mem[2] was
actually ops_mem[3] already. You don't need the dummy var now and
Dwarf_Op *ops doesn't need to be initialized (the dwarf_frame_register
will initialize it).

Note that [1] didn't change the args of the dwarf_frame_register, but
did fix a similar bug in one of the elfutils own tests (and updated
the comment on the function to hopefully be more clear).

Cheers,

Mark

> Cc: Mark Wielaard <mjw@redhat.com>
> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  tools/perf/arch/powerpc/util/skip-callchain-idx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> index 3018a054526a..20cd6244863b 100644
> --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> @@ -45,7 +45,7 @@ static const Dwfl_Callbacks offline_callbacks = {
>   */
>  static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
>  {
> -	Dwarf_Op ops_mem[2];
> +	Dwarf_Op ops_mem[3];
>  	Dwarf_Op dummy;
>  	Dwarf_Op *ops = &dummy;
>  	size_t nops;
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-09-28 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 19:52 [PATCH] perf tools: Fix compilation on powerpc Jiri Olsa
2021-09-28 20:39 ` Mark Wielaard [this message]
2021-10-27 19:59   ` Arnaldo Carvalho de Melo
2021-09-30 10:03 ` kajoljain
  -- strict thread matches above, loose matches on Subject: below --
2009-11-24  4:19 Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVN9aZsIRYrhT1mU@wildebeest.org \
    --to=mark@klomp.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox