Page 2 of 2

Re: Not linking

Posted: Thu Mar 31, 2016 2:18 am
by mikegonta
Octocontrabass wrote:
mikegonta wrote:Personally, I prefer to link separately during development.
You can still link separately even when using GCC to link.
No, by default (if you don't use the -c option) GCC will separately pass the output file to the linker, however "you" will not be able
to separate the two. Separate compile/link statements in a makefile are redundant, however I'm using a command script with a pause
in between which allows me to not always link - which I find convenient in the development process.

Re: Not linking

Posted: Thu Mar 31, 2016 2:42 am
by moondeck
Thank you all for the advice. I have removed all the IRQ code and will redo it all by myself. Is there any way i can verify that my GDT is setup properly? Any tools which i can use to see the contents of memory?

Re: Not linking

Posted: Thu Mar 31, 2016 2:47 am
by gerryg400
mikegonta wrote:
Octocontrabass wrote:
mikegonta wrote:Personally, I prefer to link separately during development.
You can still link separately even when using GCC to link.
No, by default (if you don't use the -c option) GCC will separately pass the output file to the linker, however "you" will not be able
to separate the two. Separate compile/link statements in a makefile are redundant, however I'm using a command script with a pause
in between which allows me to not always link - which I find convenient in the development process.
I'm sorry I don't follow what you are saying. You begin with "No, .." which seems like you are disagreeing with Octocontrabass' statement that it's possible to compile and link separately. But then say that there is an option that makes it possible but that "you" (not sure who that is) will not be able to do it.

Could you please explain what you mean? We need to be clear here. If there is any reason at all to use the ld command directly instead of using the GCC driver then we perhaps should list it here and on the wiki. If not then we should clearly advise all inexperienced users to use the GCC driver.

Re: Not linking

Posted: Thu Mar 31, 2016 2:55 am
by moondeck
For me using GCC and ld separately made me understand what is actually going on, and get a basic idea of what linking is.

Re: Not linking

Posted: Thu Mar 31, 2016 3:56 am
by FusT
For debugging your GDT, IDT, memory and a lot of other stuff I strongly recommend using bochs with either it's internal debugger or GDB.
Bochs/GDB can print the GDT on screen so you can check if all the values seen OK. Same goes for IDT, memory, processor registers and so on.

You'll still have to have a basic understanding of how a valid GDT looks though but that knowledge can easily be accuired.

Re: Not linking

Posted: Thu Mar 31, 2016 8:47 am
by mikegonta
moondeck wrote:For me using GCC and ld separately made me understand what is actually going on, and get a basic idea of what linking is.
The thing is, you - the programmer - is not using it separately if the programmer is using a makefile or GCC to link (or a combination
of both). Technically the compile/link is separate and technically the programmer initiated the compile/link, however the programmer
has no control of the separate processes. The only way the programmer can compile and link separately is either to enter the commands
directly (in which case the programmer can pause between commands) and link "separately" or use a command script with a pause
command to separate the commands and link "separately". And yes, a makefile is the much better, preferred method.
Notwithstanding and are you listening gerryg400?
mikegonta wrote:Personally, I prefer to link separately during development. That way I can concentrate on getting it to compile without concern for
getting it to link just yet. I use a Windows command script, I know a make file is better, however the script allows me more control ...
Let me add that I do this so that I don't have to link the file in the early stages. This way I don't get a pile of linker errors for uninitialized
"this, that and the other thing" which I haven't bothered doing because I am more interested in getting it to compile and/or reviewing the
asm listing for a better understanding.

Re: Not linking

Posted: Thu Mar 31, 2016 3:45 pm
by gerryg400
mikegonta wrote:
moondeck wrote:For me using GCC and ld separately made me understand what is actually going on, and get a basic idea of what linking is.
The thing is, you - the programmer - is not using it separately if the programmer is using a makefile or GCC to link (or a combination
of both). Technically the compile/link is separate and technically the programmer initiated the compile/link, however the programmer
has no control of the separate processes. The only way the programmer can compile and link separately is either to enter the commands
directly (in which case the programmer can pause between commands) and link "separately" or use a command script with a pause
command to separate the commands and link "separately". And yes, a makefile is the much better, preferred method.
Notwithstanding and are you listening gerryg400?
mikegonta wrote:Personally, I prefer to link separately during development. That way I can concentrate on getting it to compile without concern for
getting it to link just yet. I use a Windows command script, I know a make file is better, however the script allows me more control ...
Let me add that I do this so that I don't have to link the file in the early stages. This way I don't get a pile of linker errors for uninitialized
"this, that and the other thing" which I haven't bothered doing because I am more interested in getting it to compile and/or reviewing the
asm listing for a better understanding.
Yes and if I understand what you are doing your workflow seems quite normal. Using GCC to perform the link step in no way prevents you from doing any of the things you described.

So, I still say that all inexperienced developers should be encouraged to do what Octocontrabass and the wiki say and use GCC for both the compile and link steps.

Re: Not linking

Posted: Thu Mar 31, 2016 4:13 pm
by mikegonta
gerryg400 wrote:Yes and if I understand what you are doing your workflow seems quite normal. Using GCC to perform the link step in no way prevents
you from doing any of the things you described.
mikegonta wrote:Let me add that I do this so that I don't have to link the file in the early stages. This way I don't get a pile of linker errors for
uninitialized "this, that and the other thing" which I haven't bothered doing because I am more interested in getting it to compile
and/or reviewing the asm listing for a better understanding.
Ok, but once the GCC compile/link command is executed I cannot stop the linking - which is what I want to do some of the time. Sure,
I could have another separate menu option for my Assemulate script, but there's too many in there now.
gerryg400 wrote:So, I still say that all inexperienced developers should be encouraged to do what Octocontrabass and the wiki say and use GCC for
both the compile and link steps.
And I whole heartedly agree!!!
I prefer to walk the unbeaten, less traveled path.
I expect no one to lead me down that path and I expect no one to follow me down that path.
Such is the path to great inventions.

Re: Not linking

Posted: Fri Apr 01, 2016 12:14 am
by moondeck
But if it does not change anything, why bother to argue? :)