public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Adrian Bunk <bunk@stusta.de>, linux-kernel@vger.kernel.org
Subject: Re: Cleanup possibility in asm-i386/string.h
Date: Tue, 7 Feb 2006 13:08:59 +0100	[thread overview]
Message-ID: <200602071308.59827.ak@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0602071230520.9696@scrub.home>

On Tuesday 07 February 2006 13:00, Roman Zippel wrote:
> Hi,
> 
> On Tue, 7 Feb 2006, Andi Kleen wrote:
> 
> > If you feel the need to remove some more code: Now that gcc 2.95 isn't supported
> > anymore there isn't really a need to keep the handwritten inline string functions
> > in asm-i386/string.h around. Just declaring them as normal externs will cause
> > gcc to use its builtin expansions, which are typically better than these old inline
> > functions with inline assembly.
> > 
> > For out of line the C versions in lib/string.c can be used (by not setting __ARCH_*) 
> > x86-64 did it like this forever and I guess it would be valuable cleanup for i386 too.
> 
> The only problem is that we compile with -ffreestanding which implies 
> -fno-builtin, so just declaring them as normal externs is not enough and 
> you have to something like this:
> 
> #define __HAVE_ARCH_MEMSET
> extern void *memset(void *, int, __kernel_size_t);
> #define memset(d, c, n) __builtin_memset(d, c, n)
> 
> (BTW you do this already in x86-64.)

Yes thinking about it the x86-64 string.h could just be copied over to i386.
It should already do everything correctly and I don't think there is 
anything really 64bit specific in there.

> Another problem here is because of -fno-builtin it's not easy to use the 
> generic functions as fallback. x86-64 basically does this: 
> 
> #define strlen __builtin_strlen
> size_t strlen(const char * s);
> 
> #ifndef __HAVE_ARCH_STRLEN
> extern __kernel_size_t strlen(const char *);
> #endif
> 
> This means you define a prototype for the builtin function and not for the 
> normal function. I'm not sure this is really intended.

What good would be a prototype for a symbol that is defined to a different symbol?

-Andi


  reply	other threads:[~2006-02-07 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07 11:15 Cleanup possibility in asm-i386/string.h Andi Kleen
2006-02-07 12:00 ` Roman Zippel
2006-02-07 12:08   ` Andi Kleen [this message]
2006-02-07 12:39     ` Roman Zippel
2006-02-10  0:05       ` Adrian Bunk
2006-02-10  0:23         ` Andi Kleen
2006-02-10  1:00           ` Kyle Moffett
2006-02-10 13:02           ` Roman Zippel
2006-02-10 13:49             ` Andi Kleen
2006-02-10 14:46               ` Roman Zippel
2006-02-10 15:02                 ` Andi Kleen
2006-02-10  0:53         ` Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200602071308.59827.ak@suse.de \
    --to=ak@suse.de \
    --cc=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox