Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: support -fmacro-prefix-map for external modules

This commit makes -fmacro-prefix-map work for external modules built in
a separate output directory. It improves the reproducibility of external
modules and provides the benefits described in commit a73619a845d5
("kbuild: use -fmacro-prefix-map to make __FILE__ a relative path").

When building_out_of_srctree is not defined (e.g., when the kernel or
external module is built in the source directory), this option is
unnecessary.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

+4 -2
+4 -2
Makefile
··· 1041 1041 KBUILD_CFLAGS += -fconserve-stack 1042 1042 endif 1043 1043 1044 - # change __FILE__ to the relative path from the srctree 1045 - KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) 1044 + # change __FILE__ to the relative path to the source directory 1045 + ifdef building_out_of_srctree 1046 + KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=) 1047 + endif 1046 1048 1047 1049 # include additional Makefiles when needed 1048 1050 include-y := scripts/Makefile.extrawarn