lkml.org 
[lkml]   [2000]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: string-486.h?
On Wed, Feb 23, 2000 at 06:55:57PM +0100, Daniel.Egger@suse.de wrote:
> On 23 Feb, Brian Gerst wrote:
>
> > The code in include/asm-i386/string-486.h has been disabled for quite
> > long time now. Is it truly dead and can be removed? What is broken
> > with it?
>
> I'd like to append another question. The current gcc seems to have
> problems with memcpy calls in the kernel source. When compiling a
> kernel I get unresolved memcpy symbols for example in hisax.
> Although memcpy is used all over the source I get these
> unresolved symbols just in a few places.
>


This issue just came up yesterday on the RTLinux mailing list.
gcc will generate 'call memset' and 'call memcpy' in several
situations relating to automatic variables. In particular, the
following code will generate a 'call memset'[1]:

{
char str[12] = "mystring";

...
}

There are several ways to solve this problem, including modifying
gcc not to emit such code when it is not appropriate, adding hard
declarations of memset, memcpy, etc. to the kernel, and possibly
just saying that code that causes gcc to generate 'call memset'
is not supported. I really have no opinion on the matter.



dave...


[1] On the RTL list, I made a fool of myself by effectively saying
"bullshit, I don't believe it." So here is the example:

it.c:

#include <stdio.h>
int main(int argc,char *argv[])
{
char str[12]="mystring";
printf(str);
return 0;
}

cc -S it.c

it.s:

.file "it.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.string "mystring"
.globl memset
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $12,%esp
movl $.LC0,%eax
movl (%eax),%edx
movl %edx,-12(%ebp)
movl 4(%eax),%edx
movl %edx,-8(%ebp)
movb 8(%eax),%al
movb %al,-4(%ebp)
leal -3(%ebp),%eax
pushl $3
pushl $0
pushl %eax
call memset
addl $12,%esp
leal -12(%ebp),%eax
pushl %eax
call printf
addl $4,%esp
xorl %eax,%eax
jmp .L1
.align 4
.L1:
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.7.2.3"


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.053 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site