Linker error - please help!

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
spookyrufus
Posts: 3
Joined: Thu Dec 07, 2006 2:57 am
Location: Alassio (Italiy)
Contact:

Linker error - please help!

Post by spookyrufus »

Hi there!
I'm following Bran's Kernel Tutorial to develop my very firsti OS.
I just reached the IDT chapter and I'm stuck with an error I'm getting from the linker.

The error message is:

start.o:start.o:(.text+0x53): undefined reference to `_idtp'
main.o:main.c:(.text+0x14f): undefined reference to `_idt_install'

The tutorial I'm following can be found at:

http://www.osdever.net/bkerndev/index.php?the_id=90

PLEASE NOTE that I'm receiving these errors even if I try to compile the tutorial's code itself!

Please someone help to solve this problem. I really can't find a way to do that.
I'm looking forward to receive (good) news (soon)
:D


Andrea
Many things have to be seen to be believed.
Other things have to be believed to be seen.
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Post by urxae »

I'm guessing you're compiling to ELF format. If so, C functions don't get a leading underscore when accessed from assembly.
The solution is to either remove them from your assembly file or pass '-fleading-underscore' to GCC when compiling the C files.

If you remove them and later want to compile to an object format that does use leading underscores, either pass '-fno-leading-underscore' to GCC or '--prefix _' to NASM.
oscoder
Member
Member
Posts: 59
Joined: Mon Mar 27, 2006 12:00 am
Location: UK

Post by oscoder »

I'm receiving these errors even if I try to compile the tutorial's code itself
Strange - I downloaded the code at the end of the tutorial, and it seemed to compile and link fine (although there were a few compiler warnings about certain code - but nothing to worry about).

Do you have a script/bat file that compiles and links everything? If so it would help for you to post that (it sounds as though you've forgotten to link in the idt code). If not, could you post the commands you use to build it?
spookyrufus
Posts: 3
Joined: Thu Dec 07, 2006 2:57 am
Location: Alassio (Italiy)
Contact:

solved!

Post by spookyrufus »

Thanks. I solved the problem and was my mistake.
I forgot to link the idt.o file.
Was getting mad about this problem...now feeling stupid :oops:

Thanks a lot guys, keep up the good work!

Andrea
Many things have to be seen to be believed.
Other things have to be believed to be seen.
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Re: solved!

Post by urxae »

spookyrufus wrote:Thanks. I solved the problem and was my mistake.
I forgot to link the idt.o file.
That's also a possibility...
I was wondering why you hadn't run in to this sooner :).
Post Reply