From: Anton Blanchard gcc 3.5 is complaining about the size of copy_from_user. It turns out it is rather large and putting it out of line saves us about 30kB on a default kernel build. Signed-off-by: Anton Blanchard Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/lib/Makefile | 2 +- 25-akpm/arch/ppc64/lib/usercopy.c | 35 +++++++++++++++++++++++++++++++++++ 25-akpm/include/asm-ppc64/uaccess.h | 33 ++++++--------------------------- 3 files changed, 42 insertions(+), 28 deletions(-) diff -puN arch/ppc64/lib/Makefile~ppc64-out-of-line-some-user-copy-routines arch/ppc64/lib/Makefile --- 25/arch/ppc64/lib/Makefile~ppc64-out-of-line-some-user-copy-routines 2004-07-05 03:27:10.214871552 -0700 +++ 25-akpm/arch/ppc64/lib/Makefile 2004-07-05 03:27:10.219870792 -0700 @@ -3,7 +3,7 @@ # lib-y := checksum.o dec_and_lock.o string.o strcase.o -lib-y += copypage.o memcpy.o copyuser.o +lib-y += copypage.o memcpy.o copyuser.o usercopy.o # Lock primitives are defined as no-ops in include/linux/spinlock.h # for non-SMP configs. Don't build the real versions. diff -puN /dev/null arch/ppc64/lib/usercopy.c --- /dev/null 2003-09-15 06:40:47.000000000 -0700 +++ 25-akpm/arch/ppc64/lib/usercopy.c 2004-07-05 03:27:10.219870792 -0700 @@ -0,0 +1,35 @@ +/* + * Functions which are too large to be inlined. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#include + +unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) +{ + if (likely(access_ok(VERIFY_READ, from, n))) + n = __copy_from_user(to, from, n); + else + memset(to, 0, n); + return n; +} + +unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) +{ + if (likely(access_ok(VERIFY_WRITE, to, n))) + n = __copy_to_user(to, from, n); + return n; +} + +unsigned long copy_in_user(void __user *to, const void __user *from, + unsigned long n) +{ + might_sleep(); + if (likely(access_ok(VERIFY_READ, from, n) && + access_ok(VERIFY_WRITE, to, n))) + n =__copy_tofrom_user(to, from, n); + return n; +} diff -puN include/asm-ppc64/uaccess.h~ppc64-out-of-line-some-user-copy-routines include/asm-ppc64/uaccess.h --- 25/include/asm-ppc64/uaccess.h~ppc64-out-of-line-some-user-copy-routines 2004-07-05 03:27:10.216871248 -0700 +++ 25-akpm/include/asm-ppc64/uaccess.h 2004-07-05 03:27:10.220870640 -0700 @@ -272,33 +272,12 @@ __copy_to_user(void __user *to, const vo #define __copy_in_user(to, from, size) \ __copy_tofrom_user((to), (from), (size)) -static inline unsigned long -copy_from_user(void *to, const void __user *from, unsigned long n) -{ - if (likely(access_ok(VERIFY_READ, from, n))) - n = __copy_from_user(to, from, n); - else - memset(to, 0, n); - return n; -} - -static inline unsigned long -copy_to_user(void __user *to, const void *from, unsigned long n) -{ - if (likely(access_ok(VERIFY_WRITE, to, n))) - n = __copy_to_user(to, from, n); - return n; -} - -static inline unsigned long -copy_in_user(void __user *to, const void __user *from, unsigned long n) -{ - might_sleep(); - if (likely(access_ok(VERIFY_READ, from, n) && - access_ok(VERIFY_WRITE, to, n))) - n =__copy_tofrom_user(to, from, n); - return n; -} +extern unsigned long copy_from_user(void *to, const void __user *from, + unsigned long n); +extern unsigned long copy_to_user(void __user *to, const void *from, + unsigned long n); +extern unsigned long copy_in_user(void __user *to, const void __user *from, + unsigned long n); extern unsigned long __clear_user(void __user *addr, unsigned long size); _