Lifters & Loaders

Assume the text segment begins at 0040 000016, the data segmentbegins at 1000 000016, and the global pointer currently contains 1000 800016 You’ll see two objectfiles below, Object File 1 and Object File 2. Your task here will be to play the role of the linkerand link these two files together into the resulting executable file. The format for the executableis provided for you on the third page and the gray squares are the ones you’ll have to fill-in withresolved memory addresses, etc. I recommend printing the 3 pages out so you can refer to themeasily. If you have any questions, let me know! Odds are we’ll be discussing this in Office Hoursfor Week 11 so please join! -J. KovbaObject File 1 HeaderName Procedure AText Size 30016Data Size 6016Text Segment Address Instruction0 lw $a0,X($gp) # depends on X4 jal B # depends on B… …Data Segment 0 (X)… …RelocationInformationAddress Instruction Type Dependency0 lw X4 jal BSymbol Table Label AddressX –B –Object File 2 HeaderName Procedure BText Size 10016Data Size 2016Text Segment Address Instruction0 sw $a1, Y($gp) # depends on Y4 jal A # depends on A… …Data Segment 0 (Y)… …RelocationInformationAddress Instruction Type Dependency0 sw Y4 jal ASymbol Table Label AddressY –A –Executable FileHeaderText Size 400 # total combined textsizeData Size 80 # total combined datasizeAddressText Segment _ _ _ _ _ _ _ 16 (the memory address for Procedure A’s lw instruction) lw $a0, X($gp) X = _ _ _16

where X is the

offset relative to theglobal pointer registerto get to X in the datasegment_ _ _ _ _ _ _ 16 (the memory address for Procedure A’s jal instruction) jal B _ _ _ _ _ _ _16

where B is the

(pseudo-direct)address of ProcedureB in the text segment…0040 030016(the memory addressfor Procedure B’s lwinstruction)sw $a1, Y($gp)Y = _ _ _ _16

where Y is the

offset relative to theglobal pointer registerto get to Y in the datasegment0040 030416(the memory addressfor Procedure B’s jalinstruction)jal A_ _ _ _ _ _ _ _16

where A is the

(pseudo-direct)address of ProcedureA in the text segment…Data Segment Address_ _ _ _ _ _ _ 16 X # the location of X in the data section _ _ _ _ _ _ _16 Y # the location of Y inthe data sectionError TypesFor each of the C code snippets below, tell which of the following errors exist: scanner, syntax,semantic, linker, or if there is no error. Note: some snippets may contain multiple types oferrors. Please be sure to list all types of warning/errors you find. You might find it helpful tocompile your code to identify any warnings/errors: https://repl.it/languages/cC Code Error(s)

include

int main(){printf(“Today is the $d’th day of April.”, day);}int main(void) {int -i = 0;}

include

int main(void) {int i = -0;printf(“i = %f”, i)}

include

int main(void) {bool loop = true;while(loop)printf(“Hello, world!n”);}}

include

int main(void) {do until(i == 10){printf(“Hello, world!n”);i++;}}

include

int main(void) {int i = 0;

do{printf(“Hello, world!n”);++i;} while(i == 10)}

Sample Solution
The post Lifters & Loaders

Image result for Order Now images

CLICK HERE TO ORDER NOW!!

Leave a Reply

Your email address will not be published. Required fields are marked *