lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADHxFxQ5ph5P+ihVw2Qm-f1T-OFUQziyc8fi-k+q3-YgL-XCMw@mail.gmail.com>
Date: Sun, 19 Oct 2025 15:57:27 +0800
From: hupu <hupu.gm@...il.com>
To: Namhyung Kim <namhyung@...nel.org>, Leo Yan <leo.yan@....com>, 
	Ian Rogers <irogers@...gle.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org, 
	mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org, 
	adrian.hunter@...el.com, nathan@...nel.org, nick.desaulniers+lkml@...il.com, 
	morbo@...gle.com, justinstitt@...gle.com, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org
Subject: Re: [RFC] perf build: Allow passing extra Clang flags via EXTRA_CLANG_FLAGS

Hi Namhyung,
Thanks for your reply.

On Sun, Oct 19, 2025 at 10:30 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> Hello,
>
> On Sat, Oct 18, 2025 at 06:05:03PM +0800, hupu wrote:
> > Hi Leo, Ian, and fellow maintainers.
> >
> > On Wed, Oct 15, 2025 at 7:47 PM hupu <hupu.gm@...il.com> wrote:
> > >
> > > Hi Leo,
> > > Thank you for your reply.
> > >
> > > On Wed, Oct 15, 2025 at 5:30 PM Leo Yan <leo.yan@....com> wrote:
> > > >
> > > > Have you installed the GCC cross packages ?
> > > >
> > > >  $ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
> > > >  $ sudo apt-get install libc6-dev-aarch64-cross linux-libc-dev-aarch64-cross
> > > >  $ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross
> > > >
> > > > My understanding is arm64 cross compilation tries to find headers in the
> > > > path /usr/aarch64-linux-gnu/include/ (I confirmed this on Ubuntu/Debian
> > > > distros).  After install GCC cross packages, the headers should appear
> > > > in the folder.
> > > >
> > >
> > > I hadn’t installed the packages you mentioned earlier, but after
> > > running the installation commands you provided, I was indeed able to
> > > successfully build perf.
> > >
> > > In fact, I’m currently working on creating an SDK package, which
> > > includes a cross-toolchain that I built myself using crosstool-NG. My
> > > initial idea was to install certain third-party libraries (such as the
> > > packages you mentioned) into the cross-toolchain’s sysroot directory.
> > > With this approach, even when developing on different host machines,
> > > we could simply specify the header search path (pointing to the
> > > cross-toolchain’s sysroot directory) during compilation, and the build
> > > should succeed without requiring any additional package installation
> > > on the system.
> > >
> > > Based on this, I think allowing users to extend some options via
> > > EXTRA_CLANG_FLAGS could be a flexible way to handle such cases.
> > > However, this is just my personal thought and might not be entirely
> > > correct, so I’d like to hear your advice.
> > >
> >
> >
> > Although installing the GCC cross packages allows me to build perf
> > successfully, I still prefer to be able to pass additional Clang flags
> > via EXTRA_CLANG_FLAGS, as this approach feels more flexible to me.
> >
> > I look forward to continuing the discussion on this topic.
>
> Doesn't EXTRA_CFLAGS work for you?
>


I’ve tried using EXTRA_CFLAGS and confirm that it doesn’t work. When I
build perf with the following command, it still reports errors:
  make perf ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE
EXTRA_CFLAGS="--sysroot=$SYSROOT"

In fact, by checking the code in tools/perf/Makefile.perf, we can see
that the EXTRA_CFLAGS variable is not passed to Clang at all:

$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h
$(QUIET_CLANG)$(CLANG) -g -O2 -fno-stack-protector --target=bpf \
  $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
  -include $(OUTPUT)PERF-VERSION-FILE -include util/bpf_skel/perf_version.h \
  -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@


As shown above, EXTRA_CFLAGS only affects the GCC cross-compilation
process and has no impact on the Clang build process.
That’s why I proposed introducing an EXTRA_CLANG_FLAGS variable to
provide a way to control Clang’s compilation behavior more flexibly.

Thanks,
hupu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ