diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-03-03 06:38:52 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-26 11:44:55 -0400 |
commit | 60a3cdd0639473c79c253bc08c8ef8f882cca107 (patch) | |
tree | e72a5ca87873b286b02966a390277f828139d350 /include/linux | |
parent | b1721d0da266b4af8cb4419473b4ca36206ab200 (diff) |
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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/compiler-gcc.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index fe23792f05c1..340bc5d92772 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -28,9 +28,15 @@ | |||
28 | #define __must_be_array(a) \ | 28 | #define __must_be_array(a) \ |
29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) | 29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
30 | 30 | ||
31 | #define inline inline __attribute__((always_inline)) | 31 | /* |
32 | #define __inline__ __inline__ __attribute__((always_inline)) | 32 | * Force always-inline if the user requests it so via the .config: |
33 | #define __inline __inline __attribute__((always_inline)) | 33 | */ |
34 | #if !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4) | ||
35 | # define inline inline __attribute__((always_inline)) | ||
36 | # define __inline__ __inline__ __attribute__((always_inline)) | ||
37 | # define __inline __inline __attribute__((always_inline)) | ||
38 | #endif | ||
39 | |||
34 | #define __deprecated __attribute__((deprecated)) | 40 | #define __deprecated __attribute__((deprecated)) |
35 | #define __packed __attribute__((packed)) | 41 | #define __packed __attribute__((packed)) |
36 | #define __weak __attribute__((weak)) | 42 | #define __weak __attribute__((weak)) |