Re: [PATCH] kbuild: use prefix-map for host and user progs
From: Nicolas Schier
Date: Wed Aug 19 2026 - 06:33:19 EST
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@xxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxx>
Tested-by: Nicolas Schier <n.schier@xxxxxxxxx>