2001-03-30 07:03:30

by Chris Funderburg

[permalink] [raw]
Subject: memcpy in 2.2.19

What's wrong with this picture:

ld -m elf_i386 -T /usr/src/kernel/stable/linux/arch/i386/vmlinux.lds -e
stext arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o
init/version.o \
--start-group \
arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o
fs/fs.o ipc/ipc.o \
fs/filesystems.a \
net/network.a \
drivers/block/block.a drivers/char/char.o drivers/misc/misc.a
drivers/net/net.a drivers/scsi/scsi.a drivers/cdrom/cdrom.a
drivers/pci/pci.a drivers/pnp/pnp.a drivers/video/video.a \
/usr/src/kernel/stable/linux/arch/i386/lib/lib.a
/usr/src/kernel/stable/linux/lib/lib.a
/usr/src/kernel/stable/linux/arch/i386/lib/lib.a \
--end-group \
-o vmlinux
drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'
make: *** [vmlinux] Error 1

Is this something outside the kernel tree that I've lost? Seems a bit weird
since memcpy must be
used in thousands of other place.


---------------------------------------------------------------------
'E's not pinin'!
'E's passed on!
This parrot is no more!
He has ceased to be!
'E's expired and gone to meet 'is maker!
'E's a stiff!
Bereft of life, 'e rests in peace!
If you hadn't nailed 'im to the perch 'e'd be pushing up the daisies!
'Is metabolic processes are now 'istory!
'E's off the twig!
'E's kicked the bucket, 'e's shuffled off 'is mortal coil, run
down the curtain and joined the bleedin' choir invisibile!!
THIS IS AN EX-PARROT!!


2001-03-30 07:29:52

by Keith Owens

[permalink] [raw]
Subject: Re: memcpy in 2.2.19

On Fri, 30 Mar 2001 08:04:17 +0100,
"Chris Funderburg" <[email protected]> wrote:
>drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
>aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'

Under some circumstances gcc will generate an internal call to
memcpy(). Alas this bypasses the pre-processor so memcpy is not
converted to the kernel's internal memcpy code. The cause is normally
a structure assignment, probably this line.

struct seeprom_config *sc = (struct seeprom_config *) scarray;

Try this replacement

struct seeprom_config *sc;
memcpy(sc, scarray, sizeof(*sc));

The other possibility I can see is

p->sc = *sc;

try

memcpy(&(p->sc), sc, sizeof(*sc));

2001-03-30 10:01:29

by Jeff Garzik

[permalink] [raw]
Subject: Re: memcpy in 2.2.19

On Fri, 30 Mar 2001, Chris Funderburg wrote:
> What's wrong with this picture:
> ld -m elf_i386 -T /usr/src/kernel/stable/linux/arch/i386/vmlinux.lds -e
[...]
> -o vmlinux
> drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
> aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'
> make: *** [vmlinux] Error 1
>
> Is this something outside the kernel tree that I've lost? Seems a bit weird
> since memcpy must be
> used in thousands of other place.

It's even more strange because memcpy is not called at all from that
routine. <insert Twilight Zone music>

Generally when this occurs, someone is using a gcc feature to copy a
structure, instead of calling memcpy directly. Since the kernel is
sometimes compiled with -fno-builtins, and since we also have our own
kernel memcpy, using this particular gcc feature often runs into
problems.

It's not obvious from the code that this is going on, but it's one
possible cause.

Can you try the new aic7xxx driver? Just search any linux-kernel mail
archive for Justin Gibbs, he is always [re-]posting the link to the
latest aic7xxx driver. AFAIK it has kernel compatibility and thus
supports 2.2.x...

Jeff



2001-03-30 20:03:57

by Horst H. von Brand

[permalink] [raw]
Subject: Re: memcpy in 2.2.19

Keith Owens <[email protected]> said:
> On Fri, 30 Mar 2001 08:04:17 +0100,
> "Chris Funderburg" <[email protected]> wrote:
> >drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
> >aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'

> Under some circumstances gcc will generate an internal call to
> memcpy(). Alas this bypasses the pre-processor so memcpy is not
> converted to the kernel's internal memcpy code. The cause is normally
> a structure assignment, probably this line.
>
> struct seeprom_config *sc = (struct seeprom_config *) scarray;

Just a pointer initialization.

[...]

> The other possibility I can see is
>
> p->sc = *sc;
>
> try
>
> memcpy(&(p->sc), sc, sizeof(*sc));
--
Dr. Horst H. von Brand mailto:[email protected]
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513

2001-04-02 07:31:32

by Chris Funderburg

[permalink] [raw]
Subject: RE: memcpy in 2.2.19

My head hurts. I tried the latest aic patch. Tried it on another machine,
same version of compiler though. (Redhat gcc 2.96 20000731) - I then
tried one of the gcc snapshots, but that won't compile _at all_.

Oddly enough, the problem also occurs in reiserfs.

I've attached a copy of my .config if anyone wants to try it for
themselves...

cc -D__KERNEL__ -I/usr/src/linux/include -E -C -P -I/usr/src/linux/include -
imacros /usr/src/linux/include/asm-i386/page_offset.h -Ui386
arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds
ld -m elf_i386 -T /usr/src/linux/arch/i386/vmlinux.lds -e stext
arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o
init/version.o \
--start-group \
arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o
fs/fs.o ipc/ipc.o \
fs/filesystems.a \
net/network.a \
drivers/block/block.a drivers/char/char.o drivers/misc/misc.a
drivers/net/net.a drivers/scsi/scsi.a drivers/cdrom/cdrom.a
drivers/pci/pci.a drivers/pnp/pnp.a drivers/video/video.a \
/usr/src/linux/arch/i386/lib/lib.a /usr/src/linux/lib/lib.a
/usr/src/linux/arch/i386/lib/lib.a \
--end-group \
-o vmlinux
fs/filesystems.a(reiserfs.o): In function `ip_check_balance':
reiserfs.o(.text+0xa45e): undefined reference to `memset'
drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'
make: *** [vmlinux] Error 1



-----Original Message-----
From: Jeff Garzik [mailto:[email protected]]
Sent: 30 March 2001 11:00
To: Chris Funderburg
Cc: Linux-Kernel
Subject: Re: memcpy in 2.2.19


On Fri, 30 Mar 2001, Chris Funderburg wrote:
> What's wrong with this picture:
> ld -m elf_i386 -T /usr/src/kernel/stable/linux/arch/i386/vmlinux.lds -e
[...]
> -o vmlinux
> drivers/scsi/scsi.a(aic7xxx.o): In function `aic7xxx_load_seeprom':
> aic7xxx.o(.text+0x116bf): undefined reference to `memcpy'
> make: *** [vmlinux] Error 1
>
> Is this something outside the kernel tree that I've lost? Seems a bit
weird
> since memcpy must be
> used in thousands of other place.

It's even more strange because memcpy is not called at all from that
routine. <insert Twilight Zone music>

Generally when this occurs, someone is using a gcc feature to copy a
structure, instead of calling memcpy directly. Since the kernel is
sometimes compiled with -fno-builtins, and since we also have our own
kernel memcpy, using this particular gcc feature often runs into
problems.

It's not obvious from the code that this is going on, but it's one
possible cause.

Can you try the new aic7xxx driver? Just search any linux-kernel mail
archive for Justin Gibbs, he is always [re-]posting the link to the
latest aic7xxx driver. AFAIK it has kernel compatibility and thus
supports 2.2.x...

Jeff



Attachments:
my.config (12.55 kB)