kernel: support gcc-optimized inlining on all architectures
[openwrt/openwrt.git] / target / linux / generic / pending-4.14 / 220-optimize_inlining.patch
1 --- a/arch/x86/Kconfig.debug
2 +++ b/arch/x86/Kconfig.debug
3 @@ -284,20 +284,6 @@ config CPA_DEBUG
4 ---help---
5 Do change_page_attr() self-tests every 30 seconds.
6
7 -config OPTIMIZE_INLINING
8 - bool "Allow gcc to uninline functions marked 'inline'"
9 - ---help---
10 - This option determines if the kernel forces gcc to inline the functions
11 - developers have marked 'inline'. Doing so takes away freedom from gcc to
12 - do what it thinks is best, which is desirable for the gcc 3.x series of
13 - compilers. The gcc 4.x series have a rewritten inlining algorithm and
14 - enabling this option will generate a smaller kernel there. Hopefully
15 - this algorithm is so good that allowing gcc 4.x and above to make the
16 - decision will become the default in the future. Until then this option
17 - is there to test gcc for this.
18 -
19 - If unsure, say N.
20 -
21 config DEBUG_ENTRY
22 bool "Debug low-level entry code"
23 depends on DEBUG_KERNEL
24 --- a/lib/Kconfig.debug
25 +++ b/lib/Kconfig.debug
26 @@ -137,6 +137,20 @@ endmenu # "printk and dmesg options"
27
28 menu "Compile-time checks and compiler options"
29
30 +config OPTIMIZE_INLINING
31 + bool "Allow gcc to uninline functions marked 'inline'"
32 + ---help---
33 + This option determines if the kernel forces gcc to inline the functions
34 + developers have marked 'inline'. Doing so takes away freedom from gcc to
35 + do what it thinks is best, which is desirable for the gcc 3.x series of
36 + compilers. The gcc 4.x series have a rewritten inlining algorithm and
37 + enabling this option will generate a smaller kernel there. Hopefully
38 + this algorithm is so good that allowing gcc 4.x and above to make the
39 + decision will become the default in the future. Until then this option
40 + is there to test gcc for this.
41 +
42 + If unsure, say N.
43 +
44 config DEBUG_INFO
45 bool "Compile the kernel with debug info"
46 depends on DEBUG_KERNEL && !COMPILE_TEST
47 --- a/arch/x86/Kconfig
48 +++ b/arch/x86/Kconfig
49 @@ -296,9 +296,6 @@ config ZONE_DMA32
50 config AUDIT_ARCH
51 def_bool y if X86_64
52
53 -config ARCH_SUPPORTS_OPTIMIZED_INLINING
54 - def_bool y
55 -
56 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
57 def_bool y
58
59 --- a/include/linux/compiler-gcc.h
60 +++ b/include/linux/compiler-gcc.h
61 @@ -90,8 +90,7 @@
62 * of extern inline functions at link time.
63 * A lot of inline functions can cause havoc with function tracing.
64 */
65 -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
66 - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
67 +#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
68 #define inline \
69 inline __attribute__((always_inline, unused)) notrace __gnu_inline
70 #else