Write a linker for object modules produced by the as611 assembler. The linker should take two object modules, bind them together, resolve external references, and output the result as one object module.
The two input filenames will be given on the command line. The output filename should be a.exe.
If the output object module does not have an empty outsymbol table, print to stderr the names of all undefined symbols. Also, if there is a duplicate symbol, write an error message. Finally, if either input file is not structurally correct, an appropriate error message should be printed and the linker should exit. (Note: "Segmentation fault" is not an appropriate message!)
Here are the steps the linker should perform:
Actually there is a subtle bug in the above description concerning the end-of-list marker in the outsymbol linked lists. Think about it!
Use the symbol table routines from as611 for the linker's symbol table.
Look in ~cs611/public/prog4 for direction on how the source code will be organized. Your task is to complete the `link' function in the file link.c.
Six public test cases (pairs of assembly language source files) are available in ~cs611/public/prog4/tests. Each case tests a different aspect of the assignment. Read the file TESTS for information about the test cases. Most of these cases are simply meant to be used to test the linker and the output is not intended to be executed by sim611. Two hidden test cases will be used to test error handling and other items not covered in the public files. Test 1 will be worth 50 points, tests 2-6 will be worth 8 points each, and the two hidden test cases will be worth 5 points each.
Your implementation must be performed using C.
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.
Your code should be submitted for grading from a
CIS Alpha machine (e.g. cisunix.unh.edu).
To turn in this assignment, type:
~cs611/bin/submit prog4 link.c
Do not turn in any other files!
Submissions can be checked by typing:
~cs611/bin/scheck prog4
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday April 1. Late submissions will be accepted at the penalty of 5 points per day up to one week late.
Your programs will be graded using an CIS Alpha machine (e.g. cisunix.unh.edu) so be sure to test in that environment.
Remember: as always you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu