CS611
Fall 2002
Programming Assignment 5
Due Sunday November 10


Write a linker for IAS object files.

The linker should take five command line arguments:

  1. name of first object file
  2. name of first symbol file
  3. name of second object file
  4. name of second symbol file
  5. name of output object file

The linker should link together the first two object files using the associated symbol files and produce the output object file. Symbol information for the output object file should be written to stdout. The format of the symbol information should be identical to that used by the assembler.

The linker should mimic the IAS assembler and write to stderr informational messages about the output object file. These messages should include:

  1. number of instruction words
  2. total number of words
  3. number of cards
These messages should be printed in the identical format used by the assembler. The linker should pad the output object file with zeros out to an even card boundary.

The format of the output object file should be identical to the format of the input object files. This means the instruction sections for the two input files will need to be grouped together. Similarly, the data sections for the two input files will need to be grouped together.

Some address fields will need to be relocated. Only relocate address fields that contain addresses within the input object files. Other addresses should not be modified. In particular, absolute addresses should not be relocated. Consider addresses zero and one to be absolute addresses.

Some addresses in the symbol information will also need to be relocated.

Be sure to consider error checking. Error messages should be written to stderr. Examples of errors include:

The directory ~cs611/public/prog5 contains a set of nine tests. The tests are described in the file ~cs611/public/prog5/TESTS. These are the only tests that will be used for grading. Each test will be worth 10 points.

You may place your source code in multiple files if you wish. Every file should have a file extension of ".c". You should provide a Makefile (called "Makefile") for building your linker. The name of the executable should be "iaslink". The Makefile is worth 10 points.

Your program will be graded primarily by testing it for correct functionality. However, you may lose points if your program is not properly structured or adequately documented. Also, error checking that is not tested will be looked for in your source code. If the error checking is not present, then up to five points will be deducted.

Your assignment should be submitted for grading from a CIS Linux machine (e.g. turing.unh.edu). To turn in this assignment, type:
~cs611/bin/submit prog5 Makefile list of C files...

Submissions can be checked from a CIS Linux machine by typing:
~cs611/bin/scheck prog5

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday November 11. Late submissions will be accepted at the penalty of 5 points per day up to one week late.

Remember: as always you are expected to do your own work on this assignment. Copying code from another student or from sites on the internet is explicitly forbidden!

If you developed your code on a DOS/Windows system, be sure to appropriately transfer your files to a CIS Linux system before submitting them. You need to convert the DOS ASCII file format to UNIX format. If you need help with this, please see me.


Last modified on October 27, 2002.

Comments and questions should be directed to hatcher@unh.edu