Re: [patch 1/1] x86_64: make string func definition work asintended

From: Andrew Morton
Date: Tue May 03 2005 - 02:23:27 EST


blaisorblade@xxxxxxxx wrote:
>
> In include/asm-x86_64/string.h there are such comments:
>
> /* Use C out of line version for memcmp */
> #define memcmp __builtin_memcmp
> int memcmp(const void * cs,const void * ct,size_t count);
>
> This would mean that if the compiler does not decide to use __builtin_memcmp,
> it emits a call to memcmp to be satisfied by the C out-of-line version in
> lib/string.c. What happens is that after preprocessing, in lib/string.i you
> may find the definition of "__builtin_strcmp".
>
> Actually, by accident, in the object you will find the definition of
> strcmp and such (maybe a trick intended to redirect calls to __builtin_memcmp
> to the default memcmp when the definition is not expanded); however, this
> particular case is not a documented feature as far as I can see.
>
> Also, the EXPORT_SYMBOL does not work, so it's duplicated in the arch.

This breaks the x86 build. I guess the below is right.

You wanna check other architectures please?


diff -puN arch/i386/kernel/i386_ksyms.c~x86_64-make-string-func-definition-work-as-intended-fix arch/i386/kernel/i386_ksyms.c
--- 25/arch/i386/kernel/i386_ksyms.c~x86_64-make-string-func-definition-work-as-intended-fix 2005-05-03 00:16:36.000000000 -0700
+++ 25-akpm/arch/i386/kernel/i386_ksyms.c 2005-05-03 00:16:44.000000000 -0700
@@ -169,10 +169,6 @@ EXPORT_SYMBOL(rtc_lock);
EXPORT_SYMBOL_GPL(set_nmi_callback);
EXPORT_SYMBOL_GPL(unset_nmi_callback);

-#undef memcmp
-extern int memcmp(const void *,const void *,__kernel_size_t);
-EXPORT_SYMBOL(memcmp);
-
EXPORT_SYMBOL(register_die_notifier);
#ifdef CONFIG_HAVE_DEC_LOCK
EXPORT_SYMBOL(_atomic_dec_and_lock);
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/