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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADHxFxQHFkn-J9R6AJY8LxkDN-eTWjp34VvoQDcshfZs1eF0rQ@mail.gmail.com>
Date: Mon, 20 Oct 2025 10:38:17 +0800
From: hupu <hupu.gm@...il.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Leo Yan <leo.yan@....com>, Ian Rogers <irogers@...gle.com>, 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 valuable feedback.

On Mon, Oct 20, 2025 at 9:16 AM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > 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"
>
> Thanks for checking this.
>
> >
> > 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.
>
> One thing I care is that we can set clang as a default compiler using CC
> variable then meaning of EXTRA_CFLAGS and EXTRA_CLANG_FLAGS may be
> confusing.  I guess EXTRA_BPF_FLAGS is clearer that we want to pass
> something when it builds BPF programs.
>

Indeed, I agree with your suggestion to rename the macro from
EXTRA_CLANG_FLAGS to EXTRA_BPF_FLAGS, as it better reflects that the
options are only intended for building BPF programs.

I will soon send the updated v2 patch with this change.

Thanks,
hupu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ