Files
android_kernel_xiaomi_sm8450/include/linux
Paul Burton 04f264d3a8 compiler.h: Allow arch-specific asm/compiler.h
We have a need to override the definition of
barrier_before_unreachable() for MIPS, which means we either need to add
architecture-specific code into linux/compiler-gcc.h or we need to allow
the architecture to provide a header that can define the macro before
the generic definition. The latter seems like the better approach.

A straightforward approach to the per-arch header is to make use of
asm-generic to provide a default empty header & adjust architectures
which don't need anything specific to make use of that by adding the
header to generic-y. Unfortunately this doesn't work so well due to
commit 28128c61e0 ("kconfig.h: Include compiler types to avoid missed
struct attributes") which caused linux/compiler_types.h to be included
in the compilation of every C file via the -include linux/kconfig.h flag
in c_flags.

Because the -include flag is present for all C files we compile, we need
the architecture-provided header to be present before any C files are
compiled. If any C files can be compiled prior to the asm-generic header
wrappers being generated then we hit a build failure due to missing
header. Such cases do exist - one pointed out by the kbuild test robot
is the compilation of arch/ia64/kernel/nr-irqs.c, which occurs as part
of the archprepare target [1].

This leaves us with a few options:

  1) Use generic-y & fix any build failures we find by enforcing
     ordering such that the asm-generic target occurs before any C
     compilation, such that linux/compiler_types.h can always include
     the generated asm-generic wrapper which in turn includes the empty
     asm-generic header. This would rely on us finding all the
     problematic cases - I don't know for sure that the ia64 issue is
     the only one.

  2) Add an actual empty header to each architecture, so that we don't
     need the generated asm-generic wrapper. This seems messy.

  3) Give up & add #ifdef CONFIG_MIPS or similar to
     linux/compiler_types.h. This seems messy too.

  4) Include the arch header only when it's actually needed, removing
     the need for the asm-generic wrapper for all other architectures.

This patch allows us to use approach 4, by including an asm/compiler.h
header from linux/compiler_types.h after the inclusion of the
compiler-specific linux/compiler-*.h header(s). We do this
conditionally, only when CONFIG_HAVE_ARCH_COMPILER_H is selected, in
order to avoid the need for asm-generic wrappers & the associated build
ordering issue described above. The asm/compiler.h header is included
after the generic linux/compiler-*.h header(s) for consistency with the
way linux/compiler-intel.h & linux/compiler-clang.h are included after
the linux/compiler-gcc.h header that they override.

[1] https://lists.01.org/pipermail/kbuild-all/2018-August/051175.html

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Patchwork: https://patchwork.linux-mips.org/patch/20269/
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: James Hogan <jhogan@kernel.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-arch@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: linux-mips@linux-mips.org
2018-08-21 10:05:45 -07:00
..
2018-05-25 18:23:56 +02:00
2018-05-23 14:01:03 +02:00
2018-01-01 22:54:42 -08:00
2018-06-05 10:48:09 -04:00
2018-06-07 14:23:08 +01:00
2018-06-07 17:34:35 -07:00
2018-05-26 09:16:44 +02:00
2018-06-15 18:10:01 -03:00
2018-04-20 17:18:35 -07:00
2018-04-30 13:25:14 +01:00
2018-06-14 17:01:45 +02:00
2018-03-16 10:56:13 +01:00
2018-05-28 17:41:02 +02:00
2018-05-09 17:25:13 +02:00
2018-06-15 18:10:01 -03:00
2018-03-16 15:45:51 -07:00
2018-03-16 10:55:47 +01:00
2018-03-26 15:09:38 +02:00
2018-04-27 14:34:51 +02:00
2018-06-01 07:38:16 -06:00
2018-01-01 12:40:27 -07:00
2018-03-26 15:56:44 +02:00
2018-06-15 18:10:01 -03:00
2018-04-26 09:02:01 -06:00
2018-06-07 17:34:37 -07:00
2018-05-22 13:42:16 +02:00
2018-02-22 21:13:03 +01:00
2018-03-26 08:53:43 -06:00
2018-01-17 11:30:16 +00:00
2018-05-09 12:21:46 -05:00
2018-06-21 17:39:18 +02:00
2018-04-11 10:28:38 -07:00
2018-04-12 09:41:19 -07:00
2018-06-05 08:50:16 -04:00
2018-06-15 07:55:25 +09:00
2018-06-07 17:34:35 -07:00
2018-04-11 10:28:32 -07:00
2018-06-07 17:34:37 -07:00
2018-06-12 16:19:22 -07:00
2018-06-07 17:34:39 -07:00
2018-03-26 13:14:43 -04:00
2018-03-26 13:14:43 -04:00
2018-01-28 22:17:24 -05:00
2018-06-01 14:37:35 +02:00
2018-01-08 08:22:45 -06:00
2018-01-17 15:25:50 +01:00
2018-01-08 08:22:45 -06:00
2018-06-07 17:34:36 -07:00
2018-04-11 10:28:39 -07:00
2018-01-31 17:18:37 -08:00
2018-06-06 16:10:45 -05:00
2018-05-15 15:51:38 +01:00
2018-06-07 17:34:35 -07:00
2018-05-31 00:13:56 +08:00
2018-05-11 17:28:45 -07:00
2018-05-11 17:28:45 -07:00
2018-06-04 17:28:20 -04:00
2018-03-01 08:33:05 -07:00
2018-05-04 12:48:54 -07:00
2018-04-30 05:14:55 -07:00
2018-06-07 17:34:35 -07:00
2018-06-07 17:34:37 -07:00
2018-05-03 15:55:23 -07:00
2018-01-15 12:07:46 -08:00
2018-04-16 14:25:08 -06:00
2018-02-06 18:32:47 -08:00
2018-01-09 16:27:43 +01:00
2018-05-18 11:40:27 -04:00
2018-05-19 13:57:31 +02:00
2018-05-19 13:57:31 +02:00
2018-04-26 15:08:04 -04:00
2018-02-06 18:32:44 -08:00
2018-05-14 09:51:34 -04:00