2001-12-05 18:18:56

by Michael Smith

[permalink] [raw]
Subject: Unresolved symbol memset

Hello all,
I am new the Linux world and have a problem which is somewhat
confusing. I am using the system call memset() in kernel code written
for Red Hat 7.1(kernel 2.4). I needed to make this code compatible with
Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
This is only happening in one place of the code in one file. I am using
memset() in other areas of the code which does not lead to the problem.
If anyone can clue me in to what this possible can be, it would greatly
be appreciated.

Thank you in advance,
Michael


2001-12-05 18:31:06

by Randy.Dunlap

[permalink] [raw]
Subject: Re: Unresolved symbol memset

On Wed, 5 Dec 2001, Michael Smith wrote:

| Hello all,
| I am new the Linux world and have a problem which is somewhat
| confusing. I am using the system call memset() in kernel code written
| for Red Hat 7.1(kernel 2.4). I needed to make this code compatible with
| Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
| This is only happening in one place of the code in one file. I am using
| memset() in other areas of the code which does not lead to the problem.
| If anyone can clue me in to what this possible can be, it would greatly
| be appreciated.

um, memset() isn't actually a system call.
However-- does the problem source file have
#include <linux/string.h>
in it? It should.
Or perhaps you could post the problem source file and/or
gcc messages.

--
~Randy

2001-12-05 18:40:56

by John Levon

[permalink] [raw]
Subject: Re: Unresolved symbol memset

On Wed, Dec 05, 2001 at 01:18:37PM -0500, Michael Smith wrote:

> Hello all,
> I am new the Linux world and have a problem which is somewhat
> confusing. I am using the system call memset() in kernel code written
> for Red Hat 7.1(kernel 2.4). I needed to make this code compatible with
> Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
> This is only happening in one place of the code in one file. I am using
> memset() in other areas of the code which does not lead to the problem.

You need to compile with optimisation turned on.

Btw, your question would be more appropriate on the kernelnewbies list - see
http://www.kernelnewbies.org/

regards
john

--
"Faced with the prospect of rereading this book, I would rather have
my brains ripped out by a plastic fork."
- Charles Cooper on "Business at the Speed of Thought"

2001-12-05 18:56:16

by Michael Smith

[permalink] [raw]
Subject: RE: Unresolved symbol memset

That particular header is included. As I mentioned, I am using memset
in other areas of the code, as well as the same file. If I take this
one call out of the source, it compiles, links and I am able to perform
and insmod correctly. Below are the headers that are included in the
file, and the area of the code that is causing the problem. Let me say
that the code, even with this particular call in, compiles and links.
The problem happens when I go to perform the insmod on it.

#include <memory.h>
#include <string.h>
#include "myownheaders.h"


void myfunction( void *a, int len )
{
....
Mymemmove() //used because NdisMoveMemory can not be used
memset( &a->WORD[NUMWORDS-len], 0, len*4);
...
}


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, December 05, 2001 1:27 PM
To: Michael Smith
Cc: [email protected]
Subject: Re: Unresolved symbol memset

On Wed, 5 Dec 2001, Michael Smith wrote:

| Hello all,
| I am new the Linux world and have a problem which is somewhat
| confusing. I am using the system call memset() in kernel code written
| for Red Hat 7.1(kernel 2.4). I needed to make this code compatible
with
| Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
| This is only happening in one place of the code in one file. I am
using
| memset() in other areas of the code which does not lead to the
problem.
| If anyone can clue me in to what this possible can be, it would
greatly
| be appreciated.

um, memset() isn't actually a system call.
However-- does the problem source file have
#include <linux/string.h>
in it? It should.
Or perhaps you could post the problem source file and/or
gcc messages.

--
~Randy

2001-12-05 18:59:16

by Michael Smith

[permalink] [raw]
Subject: RE: Unresolved symbol memset

I have optimization turned. Using -02 in the makefile.

I am new to the linux kernel but not kernel development. If you still
think this is the wrong list, I will post on the other one. Sorry if it
is the wrong list


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of John Levon
Sent: Wednesday, December 05, 2001 1:40 PM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Re: Unresolved symbol memset

On Wed, Dec 05, 2001 at 01:18:37PM -0500, Michael Smith wrote:

> Hello all,
> I am new the Linux world and have a problem which is somewhat
> confusing. I am using the system call memset() in kernel code written
> for Red Hat 7.1(kernel 2.4). I needed to make this code compatible
with
> Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
> This is only happening in one place of the code in one file. I am
using
> memset() in other areas of the code which does not lead to the
problem.

You need to compile with optimisation turned on.

Btw, your question would be more appropriate on the kernelnewbies list -
see
http://www.kernelnewbies.org/

regards
john

--
"Faced with the prospect of rereading this book, I would rather have
my brains ripped out by a plastic fork."
- Charles Cooper on "Business at the Speed of Thought"

2001-12-05 19:01:56

by Randy.Dunlap

[permalink] [raw]
Subject: RE: Unresolved symbol memset

Are you compiling with "-O2" (as mentioned by someone else) ?

~Randy

On Wed, 5 Dec 2001, Michael Smith wrote:

| That particular header is included. As I mentioned, I am using memset
| in other areas of the code, as well as the same file. If I take this
| one call out of the source, it compiles, links and I am able to perform
| and insmod correctly. Below are the headers that are included in the
| file, and the area of the code that is causing the problem. Let me say
| that the code, even with this particular call in, compiles and links.
| The problem happens when I go to perform the insmod on it.
|
| #include <memory.h>
| #include <string.h>
| #include "myownheaders.h"
|
|
| void myfunction( void *a, int len )
| {
| ....
| Mymemmove() //used because NdisMoveMemory can not be used
| memset( &a->WORD[NUMWORDS-len], 0, len*4);
| ...
| }
|
|
| -----Original Message-----
| From: [email protected]
| [mailto:[email protected]] On Behalf Of
| [email protected]
| Sent: Wednesday, December 05, 2001 1:27 PM
| To: Michael Smith
| Cc: [email protected]
| Subject: Re: Unresolved symbol memset
|
| On Wed, 5 Dec 2001, Michael Smith wrote:
|
| | Hello all,
| | I am new the Linux world and have a problem which is somewhat
| | confusing. I am using the system call memset() in kernel code written
| | for Red Hat 7.1(kernel 2.4). I needed to make this code compatible
| with
| | Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
| | This is only happening in one place of the code in one file. I am
| using
| | memset() in other areas of the code which does not lead to the
| problem.
| | If anyone can clue me in to what this possible can be, it would
| greatly
| | be appreciated.
|
| um, memset() isn't actually a system call.
| However-- does the problem source file have
| #include <linux/string.h>
| in it? It should.
| Or perhaps you could post the problem source file and/or
| gcc messages.

2001-12-05 19:07:09

by Randy.Dunlap

[permalink] [raw]
Subject: RE: Unresolved symbol memset

On Wed, 5 Dec 2001, Michael Smith wrote:

| I have optimization turned. Using -02 in the makefile.

That's a capital (upper case) 'O', not a zero (0).

And you should be #include-ing <linux/string.h>, _not_ <string.h>.

~Randy

| I am new to the linux kernel but not kernel development. If you still
| think this is the wrong list, I will post on the other one. Sorry if it
| is the wrong list
|
|
| -----Original Message-----
| From: [email protected]
| [mailto:[email protected]] On Behalf Of John Levon
| Sent: Wednesday, December 05, 2001 1:40 PM
| To: [email protected]
| Cc: [email protected]; [email protected]
| Subject: Re: Unresolved symbol memset
|
| On Wed, Dec 05, 2001 at 01:18:37PM -0500, Michael Smith wrote:
|
| > Hello all,
| > I am new the Linux world and have a problem which is somewhat
| > confusing. I am using the system call memset() in kernel code written
| > for Red Hat 7.1(kernel 2.4). I needed to make this code compatible
| with
| > Red Hat 6.2(kernel 2.2) and seem to be getting a unresolved symbol.
| > This is only happening in one place of the code in one file. I am
| using
| > memset() in other areas of the code which does not lead to the
| problem.

2001-12-05 19:10:16

by Richard B. Johnson

[permalink] [raw]
Subject: RE: Unresolved symbol memset

On Wed, 5 Dec 2001, Michael Smith wrote:

> I have optimization turned. Using -02 in the makefile.
> ^___________ < Need more coffee >

It's -O2, not -02


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.


2001-12-05 19:12:50

by Michael Smith

[permalink] [raw]
Subject: RE: Unresolved symbol memset

That 'O' was a miss type, it is '0' in the makefile. Sorry

-----Original Message-----
From: Richard B. Johnson [mailto:[email protected]]
Sent: Wednesday, December 05, 2001 2:09 PM
To: Michael Smith
Cc: 'John Levon'; [email protected];
[email protected]
Subject: RE: Unresolved symbol memset

On Wed, 5 Dec 2001, Michael Smith wrote:

> I have optimization turned. Using -02 in the makefile.
> ^___________ < Need more coffee >

It's -O2, not -02


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.

2001-12-05 19:17:26

by Tommy Reynolds

[permalink] [raw]
Subject: Re: Unresolved symbol memset

More important activities lacking, "Michael Smith" <[email protected]> wrote:

> That particular header is included. As I mentioned, I am using memset
> in other areas of the code, as well as the same file. If I take this
> one call out of the source, it compiles, links and I am able to perform
> and insmod correctly. Below are the headers that are included in the
> file, and the area of the code that is causing the problem. Let me say
> that the code, even with this particular call in, compiles and links.
> The problem happens when I go to perform the insmod on it.
>
> #include <memory.h>
> #include <string.h>
> #include "myownheaders.h"
>
>
> void myfunction( void *a, int len )
> {
> ....
> Mymemmove() //used because NdisMoveMemory can not be used
> memset( &a->WORD[NUMWORDS-len], 0, len*4);
> ...
> }

Inside a driver (or module) file, any include reference that doesn't begin with
either <linux/foo.h> or <asm/foo.h> should always raise a red flag. There are
user-land header files ("/usr/include") and kernel header files
("/usr/src/linux/include") and never the twain shall meet.

Mixing includes is always a bad idea.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- --
Tommy Reynolds | mailto: <[email protected]>
Red Hat, Inc., Embedded Development Services | Phone: +1.256.704.9286
307 Wynn Drive NW, Huntsville, AL 35805 USA | FAX: +1.256.837.3839
Senior Software Developer | Mobile: +1.919.641.2923


Attachments:
(No filename) (197.00 B)

2001-12-05 19:35:16

by Michael Smith

[permalink] [raw]
Subject: RE: Unresolved symbol memset

Taking your advice I removed the header memory.h and switched the
include for string.h to be linux/string.h. This seemed to fix the
problem. I thank you all for your input and appreciate the time you all
took

Michael

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Tommy Reynolds
Sent: Wednesday, December 05, 2001 2:17 PM
To: Michael Smith
Cc: [email protected]
Subject: Re: Unresolved symbol memset

More important activities lacking, "Michael Smith" <[email protected]>
wrote:

> That particular header is included. As I mentioned, I am using memset
> in other areas of the code, as well as the same file. If I take this
> one call out of the source, it compiles, links and I am able to
perform
> and insmod correctly. Below are the headers that are included in the
> file, and the area of the code that is causing the problem. Let me
say
> that the code, even with this particular call in, compiles and links.
> The problem happens when I go to perform the insmod on it.
>
> #include <memory.h>
> #include <string.h>
> #include "myownheaders.h"
>
>
> void myfunction( void *a, int len )
> {
> ....
> Mymemmove() //used because NdisMoveMemory can not be used
> memset( &a->WORD[NUMWORDS-len], 0, len*4);
> ...
> }

Inside a driver (or module) file, any include reference that doesn't
begin with
either <linux/foo.h> or <asm/foo.h> should always raise a red flag.
There are
user-land header files ("/usr/include") and kernel header files
("/usr/src/linux/include") and never the twain shall meet.

Mixing includes is always a bad idea.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- --
-- --
Tommy Reynolds | mailto:
<[email protected]>
Red Hat, Inc., Embedded Development Services | Phone: +1.256.704.9286
307 Wynn Drive NW, Huntsville, AL 35805 USA | FAX: +1.256.837.3839
Senior Software Developer | Mobile: +1.919.641.2923

2001-12-05 19:35:16

by Charles Cazabon

[permalink] [raw]
Subject: Re: Unresolved symbol memset

Michael Smith <[email protected]> wrote:
> That particular header is included.
[...]
> #include <memory.h>
> #include <string.h>
> #include "myownheaders.h"

That's not what Randy asked was included. He said:

> > However-- does the problem source file have
> > #include <linux/string.h>
> > in it? It should.

Very, very different.

Charles
--
-----------------------------------------------------------------------
Charles Cazabon <[email protected]>
GPL'ed software available at: http://www.qcc.sk.ca/~charlesc/software/
-----------------------------------------------------------------------