aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKang-Che Sung <explorer09@gmail.com>2017-01-05 09:25:03 +0800
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-09 18:52:32 +0100
commitf10f7a21d40d5ce0846414973e88602a59d4580e (patch)
tree5175d6320513012ed73c1836a78440f086205b03
parent61a91af63dbc91f85058efda5c542dfc859ab1be (diff)
downloadbusybox-w32-f10f7a21d40d5ce0846414973e88602a59d4580e.tar.gz
busybox-w32-f10f7a21d40d5ce0846414973e88602a59d4580e.tar.bz2
busybox-w32-f10f7a21d40d5ce0846414973e88602a59d4580e.zip
Allow FAST_FUNC to be overridden at build time
Busybox uses FAST_FUNC macro to tweak with IA-32 calling conventions in order to make the function call slightly smaller or slightly faster. However, when I experiment with GCC's LTO (Link Time Optimization), I discovered that FAST_FUNC could hinder LTO's optimization so that the resulting executable become a few bytes larger (than what is compiled without FAST_FUNC). This change allows to specify e.g. CONFIG_EXTRA_CFLAGS="-DFAST_FUNC= -flto" and compile with LTO without a source code hack. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/platform.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/platform.h b/include/platform.h
index c987d418c..6c7d03dc7 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -108,13 +108,18 @@
108 * and/or smaller by using modified ABI. It is usually only needed 108 * and/or smaller by using modified ABI. It is usually only needed
109 * on non-static, busybox internal functions. Recent versions of gcc 109 * on non-static, busybox internal functions. Recent versions of gcc
110 * optimize statics automatically. FAST_FUNC on static is required 110 * optimize statics automatically. FAST_FUNC on static is required
111 * only if you need to match a function pointer's type */ 111 * only if you need to match a function pointer's type.
112#if __GNUC_PREREQ(3,0) && defined(i386) /* || defined(__x86_64__)? */ 112 * FAST_FUNC may not work well with -flto so allow user to disable this.
113 * (-DFAST_FUNC= )
114 */
115#ifndef FAST_FUNC
116# if __GNUC_PREREQ(3,0) && defined(i386)
113/* stdcall makes callee to pop arguments from stack, not caller */ 117/* stdcall makes callee to pop arguments from stack, not caller */
114# define FAST_FUNC __attribute__((regparm(3),stdcall)) 118# define FAST_FUNC __attribute__((regparm(3),stdcall))
115/* #elif ... - add your favorite arch today! */ 119/* #elif ... - add your favorite arch today! */
116#else 120# else
117# define FAST_FUNC 121# define FAST_FUNC
122# endif
118#endif 123#endif
119 124
120/* Make all declarations hidden (-fvisibility flag only affects definitions) */ 125/* Make all declarations hidden (-fvisibility flag only affects definitions) */