Skip to content

Commit a95b37e

Browse files
committed
kbuild: get <linux/compiler_types.h> out of <linux/kconfig.h>
Since commit 28128c6 ("kconfig.h: Include compiler types to avoid missed struct attributes"), <linux/kconfig.h> pulls in kernel-space headers to unrelated places. Commit 0f9da84 ("MIPS: boot: Define __ASSEMBLY__ for its.S build") suppress the build error by defining __ASSEMBLY__, but ITS (i.e. DTS) is not assembly, and should not include <linux/compiler_types.h> in the first place. Looking at arch/s390/tools/Makefile, host programs gen_facilities and gen_opcode_table now pull in <linux/compiler_types.h> as well. The motivation for that commit was to define necessary attributes before any struct is defined. Obviously, this happens only in C. It is enough to include <linux/compiler_types.h> only when compiling C files, and only when compiling kernel space. Move the include to c_flags. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 127668c commit a95b37e

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

‎include/linux/kconfig.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,4 @@
7070
*/
7171
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
7272

73-
/* Make sure we always have all types and struct attributes defined. */
74-
#include <linux/compiler_types.h>
75-
7673
#endif /* __LINUX_KCONFIG_H */

‎scripts/Makefile.lib‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ __cpp_flags = $(call flags,_cpp_flags)
152152
endif
153153

154154
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
155+
-include $(srctree)/include/linux/compiler_types.h \
155156
$(__c_flags) $(modkern_cflags) \
156157
$(basename_flags) $(modname_flags)
157158

0 commit comments

Comments
 (0)