linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* using memset in a module
@ 2002-09-26 22:49 Shaya Potter
  2002-09-26 22:49 ` David S. Miller
  2002-09-26 22:51 ` Randy.Dunlap
  0 siblings, 2 replies; 7+ messages in thread
From: Shaya Potter @ 2002-09-26 22:49 UTC (permalink / raw)
  To: linux-kernel

I have a problem using memset in a module.

I've tried including <linux/string.h> or <asm/string.h> but whenever I
compile with gcc 2.95, the resulting object has memset being an
undefined symbol.  When I compile with gcc-3.2 it works right as is
inline in the code and there's no symbol.

has anyone seen this b4?  Is this a gcc bug? a kernel header bug? a bug
in my coding (i.e. does one have to do anything else besides include
<linux or asm/string.h> or have special gcc cmd line options that are
different from whats normally needed for a module).

if it matters, I'm using the debian gcc's

spotter@zaphod:~/cvs/zap/virtualization$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)

and (cutting the cruft)
gcc version 3.2.1 20020924 (Debian prerelease)

thanks,

shaya potter (tearing his hair out)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-26 22:49 using memset in a module Shaya Potter
@ 2002-09-26 22:49 ` David S. Miller
  2002-09-26 22:58   ` Shaya Potter
  2002-09-26 22:51 ` Randy.Dunlap
  1 sibling, 1 reply; 7+ messages in thread
From: David S. Miller @ 2002-09-26 22:49 UTC (permalink / raw)
  To: spotter; +Cc: linux-kernel

   From: Shaya Potter <spotter@cs.columbia.edu>
   Date: 26 Sep 2002 18:49:22 -0400

   I have a problem using memset in a module.
   
You cannot use different compilers to build modules than
were used to build the kernel itself.

If 2.95 was used to build the kernel, and you then try to
use gcc-3.{0,1,2} to build a module that resulting module
will have little chance of working.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-26 22:49 using memset in a module Shaya Potter
  2002-09-26 22:49 ` David S. Miller
@ 2002-09-26 22:51 ` Randy.Dunlap
  2002-09-26 23:02   ` Shaya Potter
  1 sibling, 1 reply; 7+ messages in thread
From: Randy.Dunlap @ 2002-09-26 22:51 UTC (permalink / raw)
  To: Shaya Potter; +Cc: linux-kernel

On 26 Sep 2002, Shaya Potter wrote:

| I have a problem using memset in a module.
|
| I've tried including <linux/string.h> or <asm/string.h> but whenever I
| compile with gcc 2.95, the resulting object has memset being an
| undefined symbol.  When I compile with gcc-3.2 it works right as is
| inline in the code and there's no symbol.
|
| has anyone seen this b4?  Is this a gcc bug? a kernel header bug? a bug
| in my coding (i.e. does one have to do anything else besides include
| <linux or asm/string.h> or have special gcc cmd line options that are
| different from whats normally needed for a module).
|
| if it matters, I'm using the debian gcc's
|
| spotter@zaphod:~/cvs/zap/virtualization$ gcc -v
| Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
| gcc version 2.95.4 20011002 (Debian prerelease)
|
| and (cutting the cruft)
| gcc version 3.2.1 20020924 (Debian prerelease)

What gcc options are you using?
You need -O2 at least.
          ^ upper-case letter O

-- 
~Randy


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-26 22:49 ` David S. Miller
@ 2002-09-26 22:58   ` Shaya Potter
  0 siblings, 0 replies; 7+ messages in thread
From: Shaya Potter @ 2002-09-26 22:58 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

On Thu, 2002-09-26 at 18:49, David S. Miller wrote:
>    From: Shaya Potter <spotter@cs.columbia.edu>
>    Date: 26 Sep 2002 18:49:22 -0400
> 
>    I have a problem using memset in a module.
>    
> You cannot use different compilers to build modules than
> were used to build the kernel itself.
> 
> If 2.95 was used to build the kernel, and you then try to
> use gcc-3.{0,1,2} to build a module that resulting module
> will have little chance of working.

I know that, gcc-3.2 was an act of desperation after gcc-2.95 wasn't
working at all.  I just wanted to see if it made a diff and it did,
didnt even bother try loading the resulting .o

shaya


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-26 22:51 ` Randy.Dunlap
@ 2002-09-26 23:02   ` Shaya Potter
  2002-09-27 15:20     ` Dan Aloni
  0 siblings, 1 reply; 7+ messages in thread
From: Shaya Potter @ 2002-09-26 23:02 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

On Thu, 2002-09-26 at 18:51, Randy.Dunlap wrote:
> On 26 Sep 2002, Shaya Potter wrote:
> 
> | I have a problem using memset in a module.
> |
> | I've tried including <linux/string.h> or <asm/string.h> but whenever I
> | compile with gcc 2.95, the resulting object has memset being an
> | undefined symbol.  When I compile with gcc-3.2 it works right as is
> | inline in the code and there's no symbol.
> |
> | has anyone seen this b4?  Is this a gcc bug? a kernel header bug? a bug
> | in my coding (i.e. does one have to do anything else besides include
> | <linux or asm/string.h> or have special gcc cmd line options that are
> | different from whats normally needed for a module).
> |
> | if it matters, I'm using the debian gcc's
> |
> | spotter@zaphod:~/cvs/zap/virtualization$ gcc -v
> | Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
> | gcc version 2.95.4 20011002 (Debian prerelease)
> |
> | and (cutting the cruft)
> | gcc version 3.2.1 20020924 (Debian prerelease)
> 
> What gcc options are you using?
> You need -O2 at least.
>           ^ upper-case letter O


yes, using it.

gcc -Wall -DMODULE -DMODVERSIONS -D__KERNEL__ -DLINUX -DEXPORT_SYMTAB
-I/usr/src/linux/include/ -I`pwd`/../migration
-I`pwd`/..//virtualization -O2 -fomit-frame-pointer -pipe
-fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2
-o fs1.o -c virtualizers/fs1.c



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-26 23:02   ` Shaya Potter
@ 2002-09-27 15:20     ` Dan Aloni
  2002-09-27 16:59       ` Shaya Potter
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Aloni @ 2002-09-27 15:20 UTC (permalink / raw)
  To: Shaya Potter; +Cc: Randy.Dunlap, linux-kernel

On Thu, Sep 26, 2002 at 07:02:26PM -0400, Shaya Potter wrote:
> On Thu, 2002-09-26 at 18:51, Randy.Dunlap wrote:
> > On 26 Sep 2002, Shaya Potter wrote:
> > 
> > | I have a problem using memset in a module.
> > |
[snio]
> > What gcc options are you using?
> > You need -O2 at least.
> >           ^ upper-case letter O
> 
> 
> yes, using it.
> 
> gcc -Wall -DMODULE -DMODVERSIONS -D__KERNEL__ -DLINUX -DEXPORT_SYMTAB
> -I/usr/src/linux/include/ -I`pwd`/../migration
> -I`pwd`/..//virtualization -O2 -fomit-frame-pointer -pipe
> -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2
> -o fs1.o -c virtualizers/fs1.c

Try adding -nostdinc. Prehaps memset is picked up as 'extern' somehow.
If that doesn't work, compile with -E instead of -c and grep the
preprocessing output for memset, that may give a clue.

-- 
Dan Aloni
da-x@gmx.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using memset in a module
  2002-09-27 15:20     ` Dan Aloni
@ 2002-09-27 16:59       ` Shaya Potter
  0 siblings, 0 replies; 7+ messages in thread
From: Shaya Potter @ 2002-09-27 16:59 UTC (permalink / raw)
  To: Dan Aloni; +Cc: Randy.Dunlap, linux-kernel

the problem was I was trying to use some gcc specific behavior.

i.e.

char devpts[15] = "/dev/pts";

under 2.95 since memset isn't a builtin there has to be a reference to
it, while under 2.96/3.2 there is a builtin, so there's no symbol
needed.

On Fri, 2002-09-27 at 11:20, Dan Aloni wrote:
> On Thu, Sep 26, 2002 at 07:02:26PM -0400, Shaya Potter wrote:
> > On Thu, 2002-09-26 at 18:51, Randy.Dunlap wrote:
> > > On 26 Sep 2002, Shaya Potter wrote:
> > > 
> > > | I have a problem using memset in a module.
> > > |
> [snio]
> > > What gcc options are you using?
> > > You need -O2 at least.
> > >           ^ upper-case letter O
> > 
> > 
> > yes, using it.
> > 
> > gcc -Wall -DMODULE -DMODVERSIONS -D__KERNEL__ -DLINUX -DEXPORT_SYMTAB
> > -I/usr/src/linux/include/ -I`pwd`/../migration
> > -I`pwd`/..//virtualization -O2 -fomit-frame-pointer -pipe
> > -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2
> > -o fs1.o -c virtualizers/fs1.c
> 
> Try adding -nostdinc. Prehaps memset is picked up as 'extern' somehow.
> If that doesn't work, compile with -E instead of -c and grep the
> preprocessing output for memset, that may give a clue.
> 
> -- 
> Dan Aloni
> da-x@gmx.net
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-09-27 16:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26 22:49 using memset in a module Shaya Potter
2002-09-26 22:49 ` David S. Miller
2002-09-26 22:58   ` Shaya Potter
2002-09-26 22:51 ` Randy.Dunlap
2002-09-26 23:02   ` Shaya Potter
2002-09-27 15:20     ` Dan Aloni
2002-09-27 16:59       ` Shaya Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).