mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
x86: add optimized inlining
add CONFIG_OPTIMIZE_INLINING=y. allow gcc to optimize the kernel image's size by uninlining functions that have been marked 'inline'. Previously gcc was forced by Linux to always-inline these functions via a gcc attribute: #define inline inline __attribute__((always_inline)) Especially when the user has already selected CONFIG_OPTIMIZE_FOR_SIZE=y this can make a huge difference in kernel image size (using a standard Fedora .config): text data bss dec hex filename 5613924 562708 3854336 10030968 990f78 vmlinux.before 5486689 562708 3854336 9903733 971e75 vmlinux.after that's a 2.3% text size reduction (!). Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
b1721d0da2
commit
60a3cdd063
4 changed files with 24 additions and 3 deletions
|
@ -28,9 +28,15 @@
|
|||
#define __must_be_array(a) \
|
||||
BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
|
||||
|
||||
#define inline inline __attribute__((always_inline))
|
||||
#define __inline__ __inline__ __attribute__((always_inline))
|
||||
#define __inline __inline __attribute__((always_inline))
|
||||
/*
|
||||
* Force always-inline if the user requests it so via the .config:
|
||||
*/
|
||||
#if !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4)
|
||||
# define inline inline __attribute__((always_inline))
|
||||
# define __inline__ __inline__ __attribute__((always_inline))
|
||||
# define __inline __inline __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#define __deprecated __attribute__((deprecated))
|
||||
#define __packed __attribute__((packed))
|
||||
#define __weak __attribute__((weak))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue