CMPS-224 Homework 2: Assemblers, Linkers & Loaders - Creating the Process Image


Refer to as needed:


All questions except #17 are taken from Appendix A.1 - A.5. Read A.1-A.5 completely before starting homework. Do not worry about references in the Appendix to chapters in the text, we will cover that material as needed.



1. How does assembly language differ from machine language?

2. Code written in a high-level language (C/Java/Python) can, in theory, be ported to a different architecture without modifying the source. An assembly language program, on the other hand, is specific to a certain architecture; i.e., a MIPS assembly program will only assemble on a MIPS architecture, x86 assembly is for Intel architectures, etc. Why is assembly not portable unless you use a cross-assembler?

3. Define the terms assembler, macro, and object file.

4. What is the difference between a compiler and an assembler? Compare GNU C compiler and GNU gas assembler under Linux as a specific example.

5. What are the disadvantages to writing in assembly language versus writing in a high-level language?

6. Define the terms external label, local label, and forward reference in the context of assembly language. How do these concepts differ from a high-level language context?

7. How does an assembler handle forward references?

8. List two important differences between assembly language and a high-level language such as C in terms of code writability.

9. List the primary sections of an object file under Unix.

10. What is an assembler directive? Give an example of one and explain what it does.