public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Haixiao Yan <haixiao.yan.cn@windriver.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, 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
Cc: stable@vger.kernel.org
Subject: [REGRESSION] perf build failed after 5cf6e76e4f4f ("libperf: Don't remove -g when EXTRA_CFLAGS are used") on riscv64 with gcc 13
Date: Thu, 19 Mar 2026 09:56:30 +0800	[thread overview]
Message-ID: <813bc5fd-0c35-46af-aea2-90798154daaa@windriver.com> (raw)

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


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-19  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  1:56 Haixiao Yan [this message]
2026-03-19  8:21 ` [REGRESSION] perf build failed after 5cf6e76e4f4f ("libperf: Don't remove -g when EXTRA_CFLAGS are used") on riscv64 with gcc 13 Ian Rogers
2026-03-20  3:28   ` Yan, Haixiao (CN)

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=813bc5fd-0c35-46af-aea2-90798154daaa@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=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