Re: [PATCH] {asm-i386,linux}/string.h:Adjustments for **NOT** usinggcc

Giacomo Amabile Catenazzi (cate@student.ethz.ch)
Wed, 02 Jun 1999 17:18:53 +0200


Horst von Brand wrote:
>
> Giacomo Amabile Catenazzi <cate@student.ethz.ch> said:
> > This patch (to linux-2.3.4) fixes:
> > 1- Force the compiler not to use the builtin (in compiler) str* and mem*
> > function, by rename it with preprocessor
> > NOTE: I have modified more function that actually need.
>
> Not needed, if the <linux/string.h> header is included whereever needed.
> BTW, what is wrong with the builtins? I see claims that they generate
> horrible code, but no substantiation... and even if so, I'd prefer to fix
> the builtins than to kludge around them in the kernel...
>
If we want builtin we use:
#define memcmp __builtin_memcmp
(as in my patch), so users ( = linux hackers) know what come from kernel
and what
come from compiler.
And in this manner we can choose to use the better code (e.g. builtin
for i486,Pentium,
use kernel code for i386,PentiumPro, but we must profile/check those
functions)

> > 2- __inline__ instead of inline (This is a header included in external
> > program [indirectly!])
>
> Should _never_ happen with glibc-2.1, and if it happens you have bigger
> trouble than that.
>
Yes, but we use __asm__, also we change __asm__ -> asm or inline ->
__inline__.
But not only glibc include linux header.
The better code is to use (in include/linux/string.h, before including
asm/string.h):
#ifdef __KERNEL__
...all declarations/definitions
#endif
so none but kernel use this *special* kernel functions.

> > 3- use __kernel_size_t instead of size_t as in linux/string.h
>
> Why?
In include/linux/string.h all declarations are with __kernel_size_t

Giacomo Catenazzi

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