Compiling and linking theory
Posted: Tue Mar 31, 2009 1:15 am
Not PHP related...
I'm quite used to using gcc to compile and link source code for me, but in the back of my mind I don't *really* know what's going on under-the-surface. Should I care? Or should I just accept that compiling and linking are required steps to produce executable files from source code without really caring how it works?
I mean, what's the compiler doing when it reads source code and produces a binary file (what do the instructions in that file look like?)? And what exactly is the linker doing when it links in shared objects etc? I don't particularly want to know in any great depth, I just want to have more of an understanding about the processes involved.
Would learning assembler help me, or is that just shifting down to a slightly lower level with the same questions left unanswered? Maybe I need to know just a little about the instructions that are sent to the CPU, such as what a simple if..else looks like at the CPU level?
Anybody here ever written a simple (really simple, not very smart) virtual machine with its own defined set of instructions to demonstrate such a thing?
I'm quite used to using gcc to compile and link source code for me, but in the back of my mind I don't *really* know what's going on under-the-surface. Should I care? Or should I just accept that compiling and linking are required steps to produce executable files from source code without really caring how it works?
I mean, what's the compiler doing when it reads source code and produces a binary file (what do the instructions in that file look like?)? And what exactly is the linker doing when it links in shared objects etc? I don't particularly want to know in any great depth, I just want to have more of an understanding about the processes involved.
Would learning assembler help me, or is that just shifting down to a slightly lower level with the same questions left unanswered? Maybe I need to know just a little about the instructions that are sent to the CPU, such as what a simple if..else looks like at the CPU level?
Anybody here ever written a simple (really simple, not very smart) virtual machine with its own defined set of instructions to demonstrate such a thing?