Not linking

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.
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Not linking

Post 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.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: Not linking

Post 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?
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Not linking

Post 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.
If a trainstation is where trains stop, what is a workstation ?
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: Not linking

Post 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.
FusT
Member
Member
Posts: 91
Joined: Wed Sep 19, 2012 3:43 am
Location: The Netherlands

Re: Not linking

Post 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.
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Not linking

Post 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.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Not linking

Post 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.
If a trainstation is where trains stop, what is a workstation ?
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Not linking

Post 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.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: Not linking

Post by moondeck »

But if it does not change anything, why bother to argue? :)
Post Reply