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>
This commit is contained in:
		
				
					committed by
					
						
						Denys Vlasenko
					
				
			
			
				
	
			
			
			
						parent
						
							61a91af63d
						
					
				
				
					commit
					f10f7a21d4
				
			@@ -108,13 +108,18 @@
 | 
			
		||||
 * and/or smaller by using modified ABI. It is usually only needed
 | 
			
		||||
 * on non-static, busybox internal functions. Recent versions of gcc
 | 
			
		||||
 * optimize statics automatically. FAST_FUNC on static is required
 | 
			
		||||
 * only if you need to match a function pointer's type */
 | 
			
		||||
#if __GNUC_PREREQ(3,0) && defined(i386) /* || defined(__x86_64__)? */
 | 
			
		||||
 * only if you need to match a function pointer's type.
 | 
			
		||||
 * FAST_FUNC may not work well with -flto so allow user to disable this.
 | 
			
		||||
 * (-DFAST_FUNC= )
 | 
			
		||||
 */
 | 
			
		||||
#ifndef FAST_FUNC
 | 
			
		||||
# if __GNUC_PREREQ(3,0) && defined(i386)
 | 
			
		||||
/* stdcall makes callee to pop arguments from stack, not caller */
 | 
			
		||||
# define FAST_FUNC __attribute__((regparm(3),stdcall))
 | 
			
		||||
#  define FAST_FUNC __attribute__((regparm(3),stdcall))
 | 
			
		||||
/* #elif ... - add your favorite arch today! */
 | 
			
		||||
#else
 | 
			
		||||
# define FAST_FUNC
 | 
			
		||||
# else
 | 
			
		||||
#  define FAST_FUNC
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Make all declarations hidden (-fvisibility flag only affects definitions) */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user