This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Next, the assembler (as) translates hello.s into machine-language instructions, packages them in a form known as a relocatable object program, and stores the result in the object ﬁle hello.o. The hello.o ﬁle is a binary ﬁle whose bytes encode machine language instructions rather than characters. If we were to view hello.o with a text editor, it would appear to be gibberish. Linking phase. Notice that our hello program calls the printf function, which is part of the standard C library provided by every C compiler. The printf function resides in a separate precompiled object ﬁle called printf.o, which must somehow be merged with our hello.o program. The linker (ld) handles this merging. The result is the hello ﬁle, which is an executable object ﬁle (or simply executable) that is ready to be loaded into memory and executed by the system.
Aside: The GNU project. G CC is one of many useful tools developed by the GNU (GNU’s Not Unix) project. The GNU project is a taxexempt charity started by Richard Stallman in 1984, with the ambitious goal of devel...
View Full Document