Upstream refresh for v1.5.0-rc1 : Upstream 19.07 : 4fb6b8c553f692eeb5bcb203e0f8ee8df0...
[librecmc/librecmc.git] / target / linux / generic / pending-4.14 / 220-optimize_inlining.patch
1 --- a/arch/arm/kernel/atags.h
2 +++ b/arch/arm/kernel/atags.h
3 @@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tag
4  const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
5         unsigned int machine_nr);
6  #else
7 -static inline const struct machine_desc *
8 +static inline const struct machine_desc * __init __noreturn
9  setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
10  {
11         early_print("no ATAGS support: can't continue\n");
12 --- a/arch/arm64/include/asm/cpufeature.h
13 +++ b/arch/arm64/include/asm/cpufeature.h
14 @@ -126,7 +126,7 @@ static inline bool cpu_have_feature(unsi
15  }
16  
17  /* System capability check for constant caps */
18 -static inline bool __cpus_have_const_cap(int num)
19 +static __always_inline bool __cpus_have_const_cap(int num)
20  {
21         if (num >= ARM64_NCAPS)
22                 return false;
23 @@ -140,7 +140,7 @@ static inline bool cpus_have_cap(unsigne
24         return test_bit(num, cpu_hwcaps);
25  }
26  
27 -static inline bool cpus_have_const_cap(int num)
28 +static __always_inline bool cpus_have_const_cap(int num)
29  {
30         if (static_branch_likely(&arm64_const_caps_ready))
31                 return __cpus_have_const_cap(num);
32 --- a/arch/mips/include/asm/bitops.h
33 +++ b/arch/mips/include/asm/bitops.h
34 @@ -462,7 +462,7 @@ static inline void __clear_bit_unlock(un
35   * Return the bit position (0..63) of the most significant 1 bit in a word
36   * Returns -1 if no 1 bit exists
37   */
38 -static inline unsigned long __fls(unsigned long word)
39 +static __always_inline unsigned long __fls(unsigned long word)
40  {
41         int num;
42  
43 @@ -528,7 +528,7 @@ static inline unsigned long __fls(unsign
44   * Returns 0..SZLONG-1
45   * Undefined if no bit exists, so code should check against 0 first.
46   */
47 -static inline unsigned long __ffs(unsigned long word)
48 +static __always_inline unsigned long __ffs(unsigned long word)
49  {
50         return __fls(word & -word);
51  }
52 --- a/arch/mips/kernel/cpu-bugs64.c
53 +++ b/arch/mips/kernel/cpu-bugs64.c
54 @@ -42,8 +42,8 @@ static inline void align_mod(const int a
55                 : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
56  }
57  
58 -static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
59 -                                    const int align, const int mod)
60 +static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w,
61 +                                             const int align, const int mod)
62  {
63         unsigned long flags;
64         int m1, m2;
65 --- a/arch/powerpc/kernel/prom_init.c
66 +++ b/arch/powerpc/kernel/prom_init.c
67 @@ -474,14 +474,14 @@ static int __init prom_next_node(phandle
68         }
69  }
70  
71 -static inline int prom_getprop(phandle node, const char *pname,
72 -                              void *value, size_t valuelen)
73 +static inline int __init prom_getprop(phandle node, const char *pname,
74 +                                     void *value, size_t valuelen)
75  {
76         return call_prom("getprop", 4, 1, node, ADDR(pname),
77                          (u32)(unsigned long) value, (u32) valuelen);
78  }
79  
80 -static inline int prom_getproplen(phandle node, const char *pname)
81 +static inline int __init prom_getproplen(phandle node, const char *pname)
82  {
83         return call_prom("getproplen", 2, 1, node, ADDR(pname));
84  }
85 --- a/arch/s390/include/asm/cpacf.h
86 +++ b/arch/s390/include/asm/cpacf.h
87 @@ -184,7 +184,7 @@ static inline int __cpacf_check_opcode(u
88         }
89  }
90  
91 -static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
92 +static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
93  {
94         if (__cpacf_check_opcode(opcode)) {
95                 __cpacf_query(opcode, mask);
96 --- a/arch/x86/Kconfig.debug
97 +++ b/arch/x86/Kconfig.debug
98 @@ -284,20 +284,6 @@ config CPA_DEBUG
99         ---help---
100           Do change_page_attr() self-tests every 30 seconds.
101  
102 -config OPTIMIZE_INLINING
103 -       bool "Allow gcc to uninline functions marked 'inline'"
104 -       ---help---
105 -         This option determines if the kernel forces gcc to inline the functions
106 -         developers have marked 'inline'. Doing so takes away freedom from gcc to
107 -         do what it thinks is best, which is desirable for the gcc 3.x series of
108 -         compilers. The gcc 4.x series have a rewritten inlining algorithm and
109 -         enabling this option will generate a smaller kernel there. Hopefully
110 -         this algorithm is so good that allowing gcc 4.x and above to make the
111 -         decision will become the default in the future. Until then this option
112 -         is there to test gcc for this.
113 -
114 -         If unsure, say N.
115 -
116  config DEBUG_ENTRY
117         bool "Debug low-level entry code"
118         depends on DEBUG_KERNEL
119 --- a/lib/Kconfig.debug
120 +++ b/lib/Kconfig.debug
121 @@ -305,6 +305,20 @@ config HEADERS_CHECK
122           exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
123           your build tree), to make sure they're suitable.
124  
125 +config OPTIMIZE_INLINING
126 +       bool "Allow compiler to uninline functions marked 'inline'"
127 +       help
128 +         This option determines if the kernel forces gcc to inline the functions
129 +         developers have marked 'inline'. Doing so takes away freedom from gcc to
130 +         do what it thinks is best, which is desirable for the gcc 3.x series of
131 +         compilers. The gcc 4.x series have a rewritten inlining algorithm and
132 +         enabling this option will generate a smaller kernel there. Hopefully
133 +         this algorithm is so good that allowing gcc 4.x and above to make the
134 +         decision will become the default in the future. Until then this option
135 +         is there to test gcc for this.
136 +
137 +         If unsure, say N.
138 +
139  config DEBUG_SECTION_MISMATCH
140         bool "Enable full Section mismatch analysis"
141         help
142 --- a/arch/x86/Kconfig
143 +++ b/arch/x86/Kconfig
144 @@ -296,9 +296,6 @@ config ZONE_DMA32
145  config AUDIT_ARCH
146         def_bool y if X86_64
147  
148 -config ARCH_SUPPORTS_OPTIMIZED_INLINING
149 -       def_bool y
150 -
151  config ARCH_SUPPORTS_DEBUG_PAGEALLOC
152         def_bool y
153  
154 --- a/include/linux/compiler-gcc.h
155 +++ b/include/linux/compiler-gcc.h
156 @@ -90,8 +90,7 @@
157   * of extern inline functions at link time.
158   * A lot of inline functions can cause havoc with function tracing.
159   */
160 -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) ||               \
161 -    !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
162 +#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
163  #define inline \
164         inline __attribute__((always_inline, unused)) notrace __gnu_inline
165  #else