Page 1 of 2
Linking Confuson
Posted: Mon Apr 30, 2007 6:33 pm
by Mini
Hello I've bean following
this tutorial for making an OS kernel in C++ and its all working except when I get to this part:
ld -T Link.ld -o Kernel.bin Loader.o Kernel.o Video.o
I made the 'Link.ld' file but were do I put that code?
And you'll have to explain it in newb for me because im only 13 so ya.
Posted: Mon Apr 30, 2007 7:13 pm
by pcmattman
OK, first some questions. Do you know C++? How well do you know it? Don't use OS development as a way to learn a language, it just makes it harder than it already is.
Link.ld is a linker script that tells ld where it needs to put each of the segments (.text, .data, .rodata, .bss) in the final file. Would you mind showing us what you have in link.ld?
Posted: Mon Apr 30, 2007 7:24 pm
by Mini
Code: Select all
/* Link.ld */
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
And I've been using C++ for about 1 year now.
Oh and if you need to know im using: flat assembler
Posted: Mon Apr 30, 2007 7:25 pm
by pcmattman
That all looks right.
except when I get to this part
What happens?
Posted: Mon Apr 30, 2007 7:31 pm
by Mini
Were do I put it?
Posted: Mon Apr 30, 2007 7:34 pm
by Pyrofan1
Put what?
Posted: Mon Apr 30, 2007 7:35 pm
by pcmattman
Put what?
Posted: Mon Apr 30, 2007 7:37 pm
by Mini
Were do I put:
ld -T Link.ld -o Kernel.bin Loader.o Kernel.o Video.o
? Do I put it in the command promt or do I put it in a .cpp or a .h file were do I put it?
Posted: Mon Apr 30, 2007 7:39 pm
by Pyrofan1
yes you enter it into a prompt or you put it in a make file
Posted: Mon Apr 30, 2007 7:39 pm
by pcmattman
OK, that's a command line to run the executable 'ld'. Do you have GCC?
Also, make sure that loader.o, kernel.o and video.o exist (assembled, compiled etc...).
Command lines are second nature to the operating system developer. You'll have to get used to them.
Posted: Mon Apr 30, 2007 7:40 pm
by Mini
how do I put it into a makefile?
Posted: Mon Apr 30, 2007 7:42 pm
by Mini
No I dont have GCC I have DevC++
Posted: Mon Apr 30, 2007 8:16 pm
by Brynet-Inc
Mini wrote:No I dont have GCC I have DevC++
Wow, This is rather... funny, DevC++ is a Windows frontend to GCC "Mini"..
Is anyone else buying this kids 1 year programming claim?
I'll say this "Mini", For someone who has been using GCC for a year.. you sure haven't learnt much if you don't even know the name of compiler you're using..
And not having the ability to determine what is and what isn't a command line? How is that possible?
Posted: Mon Apr 30, 2007 8:34 pm
by Alboin
Brynet-Inc wrote:Mini wrote:No I dont have GCC I have DevC++
Wow, This is rather... funny, DevC++ is a Windows frontend to GCC "Mini"..
Is anyone else buying this kids 1 year programming claim?
Do you know 'kid' is from the Norse word 'kidh'? I was looking up if 'kids' is possessive or just plural. Is it "kid's", or "kids' "? I can't find a straight answer.
Brynet-Inc wrote:
I'll say this "Mini", For someone who has been using GCC for a year.. you sure haven't learnt much if you don't even know the name of compiler you're using..
And not having the ability to determine what is and what isn't a command line? How is that possible?
Is there a book that actually
explains what a compiler is, what a linker is, or even what an IDE really is? It seems that every introduction book omits these. It just says "type this", "type that". This is greatly annoying and is the root for problems like this. Maybe I'll write a tutorial or something....
Posted: Tue May 01, 2007 4:28 am
by Combuster
Alboin wrote:Is there a book that actually explains what a compiler is, what a linker is, or even what an IDE really is? It seems that every introduction book omits these. It just says "type this", "type that". This is greatly annoying and is the root for problems like this. Maybe I'll write a tutorial or something....
There is wikipedia, and there's no reason to not use it instead