diff options
author | Tom Rini <trini@konsulko.com> | 2020-05-14 08:30:07 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-01 11:48:05 -0400 |
commit | 1f1a0f3db338cdcaad4f83153d1163aa18e08ed5 (patch) | |
tree | 889b3304886199357b0bbd3a881a827c98774974 /include/linux | |
parent | 67f51b40cacc70da44779cef0edb845fa0f0505d (diff) | |
download | u-boot-1f1a0f3db338cdcaad4f83153d1163aa18e08ed5.tar.gz u-boot-1f1a0f3db338cdcaad4f83153d1163aa18e08ed5.tar.xz u-boot-1f1a0f3db338cdcaad4f83153d1163aa18e08ed5.zip |
compiler_types.h: Re-introduce CONFIG_OPTIMIZE_INLINING for U-Boot
In the Linux kernel, support for forcing inline functions to be made
inline, rather than allowing the compiler to make its own choice has
been removed. With respect to performance, modern GCC (and Clang) do a
good job at deciding when to, or not to, inline code and there are no
run-time requirements in Linux anymore.
There is one downside to this, which is final binary size. On average
in U-Boot removing this support grows SPL by almost 1 kilobyte. But
there are cases where it shrinks the binary by making better inline
choices than we had forced.
Start by re-introducing CONFIG_OPTIMIZE_INLINING as a global which
essentially reverts 889b3c1245de ("compiler: remove CONFIG_OPTIMIZE_INLINING entirely")
from Linux.
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/compiler_types.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index e970f97a7f..72393a8c1a 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -129,13 +129,22 @@ struct ftrace_likely_data { #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) /* + * Force always-inline if the user requests it so via the .config. * Prefer gnu_inline, so that extern inline functions do not emit an * externally visible function. This makes extern inline behave as per gnu89 * semantics rather than c99. This prevents multiple symbol definition errors * of extern inline functions at link time. * A lot of inline functions can cause havoc with function tracing. + * Do not use __always_inline here, since currently it expands to inline again + * (which would break users of __always_inline). */ -#define inline inline __gnu_inline __inline_maybe_unused notrace +#if !defined(CONFIG_OPTIMIZE_INLINING) +#define inline inline __attribute__((__always_inline__)) __gnu_inline \ + __inline_maybe_unused notrace +#else +#define inline inline __gnu_inline \ + __inline_maybe_unused notrace +#endif /* * gcc provides both __inline__ and __inline as alternate spellings of |