This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ol deﬁnitions and references in Ñ. This process iterates over the member object ﬁles in the archive until a ﬁxed point is reached where Í and no longer change. At this point, any member object ﬁles not contained in are simply discarded and the linker proceeds to the next input ﬁle. is nonempty when the linker ﬁnishes scanning the input ﬁles on the command line, it prints an error and terminates. Otherwise it merges and relocates the object ﬁles in to build the output executable ﬁle. ¯ If Í 7.7. RELOCATION 365 Unfortunately, this algorithm can result in some bafﬂing link-time errors because the ordering of libraries and object ﬁles on the command line is signiﬁcant. If the library that deﬁnes a symbol appears on the command line before the object ﬁle that references that symbol, then the reference will not be resolved and linking will fail. For example:
unix> gcc -static ./libvector.a main2.c /tmp/cc9XH6Rp.o: In function ‘main’: /tmp/cc9XH6Rp.o(.text+0x18): undefined reference to ‘addvec’ Here is what happen...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American