Message ID | 20250213-kbuild-userprog-fixes-v1-1-f255fb477d98@linutronix.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kbuild: userprogs: two fixes for LLVM=1 | expand |
On Thu, Feb 13, 2025 at 03:55:17PM +0100, Thomas Weißschuh wrote: > scripts/Makefile.clang was changed in the linked commit to move --target from > KBUILD_CFLAGS to KBUILD_CPPFLAGS, as that generally has a broader scope. > However that variable is not inspected by the userprogs logic, > breaking cross compilation on clang. > > Use both variables to detect bitsize and target arguments for userprogs. > > Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") > Cc: stable@vger.kernel.org > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > Makefile | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 9e0d63d9d94b90672f91929e5e148e5a0c346cb6..bb5737ce7f9e79f4023c9c1f578a49a951d1e239 100644 > --- a/Makefile > +++ b/Makefile > @@ -1120,8 +1120,8 @@ LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) > endif > > # Align the bit size of userspace programs with the kernel > -KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) > -KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) > +KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) > +KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) > > # make the checker run with the right architecture > CHECKFLAGS += --arch=$(ARCH) > > -- > 2.48.1 >
On Thu, Feb 13, 2025 at 11:55 PM Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote: > > scripts/Makefile.clang was changed in the linked commit to move --target from > KBUILD_CFLAGS to KBUILD_CPPFLAGS, as that generally has a broader scope. > However that variable is not inspected by the userprogs logic, > breaking cross compilation on clang. > > Use both variables to detect bitsize and target arguments for userprogs. > > Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") > Cc: stable@vger.kernel.org > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > --- Applied to linux-kbuild/fixes. Thanks!
diff --git a/Makefile b/Makefile index 9e0d63d9d94b90672f91929e5e148e5a0c346cb6..bb5737ce7f9e79f4023c9c1f578a49a951d1e239 100644 --- a/Makefile +++ b/Makefile @@ -1120,8 +1120,8 @@ LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) endif # Align the bit size of userspace programs with the kernel -KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) -KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) +KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) +KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) # make the checker run with the right architecture CHECKFLAGS += --arch=$(ARCH)
scripts/Makefile.clang was changed in the linked commit to move --target from KBUILD_CFLAGS to KBUILD_CPPFLAGS, as that generally has a broader scope. However that variable is not inspected by the userprogs logic, breaking cross compilation on clang. Use both variables to detect bitsize and target arguments for userprogs. Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)