mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yan, Haixiao (CN)" <haixiao.yan.cn@windriver.com>
To: Ian Rogers <irogers@google.com>, Chingbin Li <liqb365@163.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	adrian.hunter@intel.com, james.clark@linaro.org,
	linux-perf-users@vger.kernel.org, pjw@kernel.org,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [REGRESSION] perf build failed after 5cf6e76e4f4f ("libperf: Don't remove -g when EXTRA_CFLAGS are used") on riscv64 with gcc 13
Date: Fri, 20 Mar 2026 11:28:51 +0800	[thread overview]
Message-ID: <06ffdbe0-1743-470e-b83a-d2c9a4702461@windriver.com> (raw)
In-Reply-To: <CAP-5=fW_O_sm9JzfCf=qDXyaffoLLRH3mob1zckESUHsG2rp-g@mail.gmail.com>


On 3/19/2026 4:21 PM, Ian Rogers wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Wed, Mar 18, 2026 at 6:57 PM Haixiao Yan
> <haixiao.yan.cn@windriver.com> wrote:
>> Hi,
>>
>> Commit[5cf6e76e4f4f](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/tools/lib/perf/Makefile?h=linux-6.6.y&id=5cf6e76e4f4fee54c0056758b639cf4919cffba9)
>> changed the libperf Makefile to preserve external CFLAGS instead of overriding them. As a result, the -O6 optimization flags from perf's
>> build system are now inherited by libperf during compilation. This triggers a false positive -Walloc-size-larger-than= warning in GCC 13 on
>> riscv64, causing the build to fail with -Werror.
>>
>> | cpumap.c: In function 'perf_cpu_map__merge':
>> | cpumap.c:422:20: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum objec
>> t size 9223372036854775807 [-Werror=alloc-size-larger-than=]
>> |   422 |         tmp_cpus = malloc(tmp_len * sizeof(struct perf_cpu));
>> |       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> | In file included from cpumap.c:3:
>> | /buildarea5/hyan-cn/project_yocto/poky/build-riscv64/tmp/work/qemuriscv64-poky-linux/perf/1.0/recipe-sysroo
>> t/usr/include/stdlib.h:672:14: note: in a call to allocation function 'malloc' declared here
>> |   672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
>> |       |              ^~~~~~
>> | rm -f /buildarea5/hyan-cn/project_yocto/poky/build-riscv64/tmp/work/qemuriscv64-poky-linux/perf/1.0/perf-1.
>> 0/libapi/libapi.a && riscv64-poky-linux-gcc-ar rcs /buildarea5/hyan-cn/project_yocto/poky/build-riscv64/tmp/w
>> ork/qemuriscv64-poky-linux/perf/1.0/perf-1.0/libapi/libapi.a /buildarea5/hyan-cn/project_yocto/poky/build-ris
>> cv64/tmp/work/qemuriscv64-poky-linux/perf/1.0/perf-1.0/libapi/libapi-in.o
>> | cc1: all warnings being treated as errors
> Hi Haixiao,
>
> this was raised before by Chingbin in:
> https://lore.kernel.org/lkml/20260212025127.841090-1-liqb365@163.com/
> I was concerned about the introduction of volatile to avoid this
> warning. I've mailed out what is hopefully a fix without volatile in
> it:
> https://lore.kernel.org/lkml/20260319081843.1650640-1-irogers@google.com/
> If you could take a look.

Hi Ian,

I have verified this patch on the master branch using gcc 13.4.0 for 
both riscv64 and ppc64 targets, and
can confirm the issue is resolved.

It would be greatly appreciated if this could be backported to the 
linux-6.6.y stable branch.

Thanks,

Haixiao

>
> Thanks,
> Ian
>
>> Steps to reproduce:
>>
>> git clone -b scarthgap https://git.yoctoproject.org/poky
>> cd poky
>> sed -i 's/af240d7d57ebf66e87bc2dff34855e630a97ead1/5cf6e76e4f4fee54c0056758b639cf4919cffba9/' meta/recipes-kernel/linux/linux-yocto_6.6.bb
>>
>> source oe-init-build-env build-riscv64
>>
>> cat >> conf/local.conf << 'EOF'
>> MACHINE = "qemuriscv64"
>> 'KERNEL_VERSION_SANITY_SKIP = "1"'
>> EOF
>>
>> bitbake perf
>>
>> I have confirmed that:
>> Known to fail: gcc 13.3.0, 13.4.0
>> Known to work: gcc 11.5.0, 12.5.0, 14.3.0, 15.2.0
>>
>> Not sure whether this is a gcc bug.
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124549 filed to gcc.
>>
>> Thanks,
>> Haixiao
>>
>>

      reply	other threads:[~2026-03-20  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  1:56 Haixiao Yan
2026-03-19  8:21 ` Ian Rogers
2026-03-20  3:28   ` Yan, Haixiao (CN) [this message]

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=06ffdbe0-1743-470e-b83a-d2c9a4702461@windriver.com \
    --to=haixiao.yan.cn@windriver.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alex@ghiti.fr \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liqb365@163.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=peterz@infradead.org \
    --cc=pjw@kernel.org \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®