ld: cannot find entry symbol

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
cmwslw
Posts: 1
Joined: Wed Mar 05, 2008 8:30 pm

ld: cannot find entry symbol

Post by cmwslw »

Hello everyone! I'm just getting started with OS dev. So far, I've had success with assembly only code (babysteps), but when I attempt a mixed language kernel (barebones C), I have problems. The compiling works fine, and generates good .o files, but when I try to link with

Code: Select all

ld -T linker.ld -o kernel.bin loader.o kernel.o
it outputs

Code: Select all

ld: warning: cannot find entry symbol _loader; defaulting to 00100000
Apparently ld can't access loader.o properly. I'm pretty sure what I typed into the command prompt is wrong, because Barebones didn't mention anything about the link command. Any suggestions?

I would be glad to update the tutorial once I get this figured out to prevent further confusion.

Thanks in advance! :wink:
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

the linker is looking for the entrypoint and isnt finding it in the C file. It shouldnt be an issue though overall. You will notice that if you included an assembly file with the label 'start' in the linker setup, it will go away.
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Post by Hangin10 »

I had that same issue. I looks really wierd. Replace "_loader" with "_main" in the link file ENTRY statement, and the error will go away and everything will still work fine. (as long as you link the loader.o first, I think)
Post Reply