mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
kbuild: use -MMD instead of -MD to exclude system headers from dependency
[ Upstream commit 30a7729771731971839cc969d2a321e6ea7a144b ]
This omits system headers from the generated header dependency.
System headers are not updated unless you upgrade the compiler. Nor do
they contain CONFIG options, so fixdep does not need to parse them.
Having said that, the effect of this optimization will be quite small
because the kernel code generally does not include system headers
except <stdarg.h>. Host programs include a lot of system headers,
but there are not so many in the kernel tree.
At first, keeping system headers in .*.cmd files might be useful to
detect the compiler update, but there is no guarantee that <stdarg.h>
is included from every file. So, I implemented a more reliable way in
the previous commit.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: 02e9a22ceef0 ("kbuild: hdrcheck: fix cross build with clang")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
74095bbbb1
commit
4451642747
4 changed files with 8 additions and 8 deletions
|
|
@ -16,7 +16,7 @@ pound := \#
|
|||
dot-target = $(dir $@).$(notdir $@)
|
||||
|
||||
###
|
||||
# The temporary file to save gcc -MD generated dependencies must not
|
||||
# The temporary file to save gcc -MMD generated dependencies must not
|
||||
# contain a comma
|
||||
depfile = $(subst $(comma),_,$(dot-target).d)
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ _hostcxx_flags += -I $(objtree)/$(obj)
|
|||
endif
|
||||
endif
|
||||
|
||||
hostc_flags = -Wp,-MD,$(depfile) $(_hostc_flags)
|
||||
hostcxx_flags = -Wp,-MD,$(depfile) $(_hostcxx_flags)
|
||||
hostc_flags = -Wp,-MMD,$(depfile) $(_hostc_flags)
|
||||
hostcxx_flags = -Wp,-MMD,$(depfile) $(_hostcxx_flags)
|
||||
|
||||
#####
|
||||
# Compile programs on the host
|
||||
|
|
|
|||
|
|
@ -160,22 +160,22 @@ modkern_aflags = $(if $(part-of-module), \
|
|||
$(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
|
||||
$(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
|
||||
|
||||
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
-include $(srctree)/include/linux/compiler_types.h \
|
||||
$(_c_flags) $(modkern_cflags) \
|
||||
$(basename_flags) $(modname_flags)
|
||||
|
||||
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
$(_a_flags) $(modkern_aflags)
|
||||
|
||||
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||
$(_cpp_flags)
|
||||
|
||||
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
|
||||
|
||||
DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
|
||||
|
||||
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
|
||||
dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
|
||||
$(addprefix -I,$(DTC_INCLUDE)) \
|
||||
-undef -D__DTS__
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
# We cannot go as far as adding -Wpedantic since it emits too many warnings.
|
||||
UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
|
||||
|
||||
override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include
|
||||
override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
|
||||
|
||||
# The following are excluded for now because they fail to build.
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in a new issue