Skip to contentSkip to conversation

Unresolved symbol memset

DISCUSSION Michael Smith 6 participants 12 messages Dec 5, 2001

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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.

Signature · 1 line
~Randy
#2 lore raw

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.

Signature · 8 lines
~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#3 lore raw

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.
#4 lore raw
In reply to Michael Smith
Quoted 13 lines · Michael Smith

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"

Quoted 7 lines

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
#5 lore raw

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

Quoted 3 lines · 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

Quoted 2 lines

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

Quoted 8 lines

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"

Quoted 7 lines

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
#6 lore raw
In reply to [email protected]
Quoted 1 line · Michael Smith

That particular header is included.

[...]

Quoted 3 lines

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

Quoted 3 lines · That's not what Randy asked was included. He
Quoted 3 lines

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

Very, very different.

Charles

Signature · 4 lines
-----------------------------------------------------------------------
Charles Cazabon                            <[email protected]>
GPL'ed software available at:  http://www.qcc.sk.ca/~charlesc/software/
-----------------------------------------------------------------------
#7 lore raw
In reply to Michael Smith
Quoted 7 lines · Michael Smith

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

Signature · 3 lines
"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" 
#8 lore raw

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

Quoted 4 lines · Michael Smith

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

Quoted 2 lines

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

Quoted 1 line

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

Signature · 9 lines
"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" 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#9 lore raw

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.
#10 lore raw
In reply to Michael Smith
Quoted 2 lines · Michael Smith

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.

#11 lore raw

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

Quoted 2 lines · Michael Smith

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.