I've got a strange error from the linker,.
Just I added few files to implement more components,. and compiles them,..
but this time, Linker complains that the mcount is not defined,. so it gives up to link objects,...
I can't understand what happens to the linker,.
so I checked the symbol tables of all object files,. then, I found strange symbol "mcount" with UND flag,.
I guess that is used for profiling,. but I didn't use profiling options for compiling codes (gcc, such as -pg, I didn't turn it on).
how can I figure this out?
thanks,.
linker complains that mcount is not defined...
linker complains that mcount is not defined...
http://nicesj.com
With the software, What You Think Is What You Get.(WYTIWYG)
With the software, What You Think Is What You Get.(WYTIWYG)
Re: linker complains that mcount is not defined...
Where is mcount declared? Is it a global variable in a single file, or is it in a header, or is it used with the extern keyword, etc... we need more information.
Posting the exact error message also helps.
Posting the exact error message also helps.
Website: https://joscor.com
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: linker complains that mcount is not defined...
QFT. Anyway: you need to do some research. Simple, really: This is a hack, and is intended only as a temporary solution until you've gotten to the root of it. From the small google escapade I just undertook, based on what Berkus said, I believe he's right.01000101 wrote: Posting the exact error message also helps.
However if that doesn't work, go read up the Std C/C++ ABI and find out exectly what features of the language require the compiler to link in that symbol. If you don't need the feature, turn it off. This is the proper solution.
The temporary hack is, (it will work assuming you're not using whatever compiler feature that's being generated) to include a static c style linked variable of the same name as the problematic one and initialize it as type void *, with a value of 0.
Code: Select all
/*From the googling I did, GCC is required to link in this symbol for one reason or another*/
static void *__gnu_mcount_nc = 0;
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: linker complains that mcount is not defined...
Thanks.
This can be off-topic, What happens with GCC? why it try to insert 'mcount' to the object files?
I didn't use '-pg' option for compiling c sources,.
Why GCC tries to add "mcount" to the object?
and isn't there a way to remove "mcount" from all object files?
only I have to declare the "mcount" to make sure linker works?
This can be off-topic, What happens with GCC? why it try to insert 'mcount' to the object files?
I didn't use '-pg' option for compiling c sources,.
Why GCC tries to add "mcount" to the object?
and isn't there a way to remove "mcount" from all object files?
only I have to declare the "mcount" to make sure linker works?
http://nicesj.com
With the software, What You Think Is What You Get.(WYTIWYG)
With the software, What You Think Is What You Get.(WYTIWYG)
Re: linker complains that mcount is not defined...
Well, what flags did you pass to GCC? And what's the exact linker error you're getting? Show us those and you're much more likely to get proper answers to your questions. Also, the gcc docs can be quite enlightening.nicesj wrote:Thanks.
This can be off-topic, What happens with GCC? why it try to insert 'mcount' to the object files?
I didn't use '-pg' option for compiling c sources,.
Why GCC tries to add "mcount" to the object?
and isn't there a way to remove "mcount" from all object files?
only I have to declare the "mcount" to make sure linker works?
Re: linker complains that mcount is not defined...
Thank you,.
This is the error message of linker.
I have 2 machine, one for server and the other one for desktop,.
When I compile my kernel on the server, linker complains to me
server has
gcc version is 4.3.1-r1
ld is 2.16.1
and my desktop has gcc 4.3.3, ld 2.19.1
it works fine, its linker did not complains to me,.
So I think, this error may be related with the version of LD.
but It is not the correct answer, so If anyone has exp like this, tell me, to understand why I failed to compile it on my server.
This is the error message of linker.
Code: Select all
make[1]: Leaving directory `/friend_home/sjpark/workspace/public/ncloader/tools'
ncloader
./.output/buddy.o: In function `buddy_init':
src/buddy.c:28: undefined reference to `mcount'
./.output/buddy.o: In function `buddy_alloc_pages':
src/buddy.c:66: undefined reference to `mcount'
./.output/buddy.o: In function `buddy_get_order':
src/buddy.c:12: undefined reference to `mcount'
./.output/buddy.o: In function `buddy_free_pages':
src/buddy.c:147: undefined reference to `mcount'
./.output/dma.o: In function `dma_init':
src/dma.c:9: undefined reference to `mcount'
./.output/fdc.o:src/fdc.c:46: more undefined references to `mcount' follow
When I compile my kernel on the server, linker complains to me
server has
gcc version is 4.3.1-r1
ld is 2.16.1
and my desktop has gcc 4.3.3, ld 2.19.1
it works fine, its linker did not complains to me,.
So I think, this error may be related with the version of LD.
but It is not the correct answer, so If anyone has exp like this, tell me, to understand why I failed to compile it on my server.
http://nicesj.com
With the software, What You Think Is What You Get.(WYTIWYG)
With the software, What You Think Is What You Get.(WYTIWYG)
Re: linker complains that mcount is not defined...
So, what's the code at line 28 and 66 look like? Did you reference 'mcount' without declaring it?./.output/buddy.o: In function `buddy_init':
src/buddy.c:28: undefined reference to `mcount'
./.output/buddy.o: In function `buddy_alloc_pages':
src/buddy.c:66: undefined reference to `mcount'
Could you post your link/compile flags? I still have a feeling profiling is being used. Have you tried to clean your build and try again with different flags?
Website: https://joscor.com
Re: linker complains that mcount is not defined...
Oooooooooops...
I'm so sorry 8 ~ |
The environment variable contains -pg flags, so when I invoke the 'make',
it started compile with "-pg" option.
I have missed the checking environment variable,
thank you for helping me,.
I'm so sorry 8 ~ |
The environment variable contains -pg flags, so when I invoke the 'make',
it started compile with "-pg" option.
I have missed the checking environment variable,
thank you for helping me,.
http://nicesj.com
With the software, What You Think Is What You Get.(WYTIWYG)
With the software, What You Think Is What You Get.(WYTIWYG)