Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Host and user progs may also use __FILE__.
Make sure it shows up canonicalized, as in regular kernel code.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 130926fa592e..322b5ce9f218 100644
--- a/Makefile
+++ b/Makefile
@@ -1188,7 +1188,10 @@ export CFLAGS_GCOV
# change __FILE__ to the relative path to the source directory
ifdef building_out_of_srctree
-KBUILD_CPPFLAGS += -fmacro-prefix-map=$(srcroot)/=
+CFLAGS_PREFIX_MAP := -fmacro-prefix-map=$(srcroot)/=
+KBUILD_CPPFLAGS += $(CFLAGS_PREFIX_MAP)
+KBUILD_USERCFLAGS += $(CFLAGS_PREFIX_MAP)
+KBUILD_HOSTCFLAGS += $(CFLAGS_PREFIX_MAP)
ifeq ($(call rustc-option-yn, --remap-path-scope=macro),y)
KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= --remap-path-scope=macro
endif
---
base-commit: bd5f485f3f026225b86573e559af0b7254ef4184
change-id: 20260819-kbuild-prefix-map-5a056c1baa98
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
On Wed, 19 Aug 2026 09:53:38 +0200, Thomas Weißschuh wrote:
> kbuild: use prefix-map for host and user progs
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next-unstable
Thanks!
[1/1] kbuild: use prefix-map for host and user progs
https://git.kernel.org/kbuild/c/7c1bcd3f127f3
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.
Best regards,
--
Cheers,
Nathan
On Wed, Aug 19, 2026 at 09:53:38AM +0200, Thomas Weißschuh wrote: > Host and user progs may also use __FILE__. > > Make sure it shows up canonicalized, as in regular kernel code. > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > --- > Makefile | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 130926fa592e..322b5ce9f218 100644 > --- a/Makefile > +++ b/Makefile > @@ -1188,7 +1188,10 @@ export CFLAGS_GCOV > > # change __FILE__ to the relative path to the source directory > ifdef building_out_of_srctree > -KBUILD_CPPFLAGS += -fmacro-prefix-map=$(srcroot)/= > +CFLAGS_PREFIX_MAP := -fmacro-prefix-map=$(srcroot)/= > +KBUILD_CPPFLAGS += $(CFLAGS_PREFIX_MAP) > +KBUILD_USERCFLAGS += $(CFLAGS_PREFIX_MAP) > +KBUILD_HOSTCFLAGS += $(CFLAGS_PREFIX_MAP) > ifeq ($(call rustc-option-yn, --remap-path-scope=macro),y) > KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= --remap-path-scope=macro > endif > > --- Thanks! Reviewed-by: Nicolas Schier <n.schier@fritz.com> Tested-by: Nicolas Schier <n.schier@fritz.com>
© 2016 - 2026 Red Hat, Inc.