On Thu, Aug 13, 2009 at 2:29 PM, JMGross <[email protected]> wrote:
> > As long as you do not have unknown symbols (e.g. if you only have one > single source file, a contiguous block of code and no libraries), you don't > really need the linker. There shouldn't be any unresolved external > symbols. There has to be a link step. I checked that both forward and backward references to labels the OP used are recorded in the ELF object file as relocations. This makes sense, because the linker must relocate the segments according to the target system memory map, so that the value of the labels changes and the addresses must be adjusted----unless the assembler was able to provide the final relocation itself which no one so far seemed to know how to do. Bottom line: go along with the way toolchain wants to work. Number one recommendation is to use inline assembly in C and let the gcc driver execute the required toolchain sequence. Barring that, use explicit assemble and link steps. Thanks to JMGross for a good overview of the linking step, btw!
