Upload a tar archive that contains a text file answers.txt with your answers for the questions… 1 answer below »

Upload a tar archive that contains a text file answers.txt with your answers for the questions not requiring code, as well as individual files for those that do, as listed below. This exercise is intended to reinforce the content of the lectures related to linking using small examples. As some answers are specific to our current environment, you must again do this exercise on our rlogin cluster. Our verification system will reject your submission if any of the required files are not in your submission. If you want to submit for a partial credit, you still need to include all the above files

Document Preview:

CS3214 Fall 2018 Exercise 2 Due: See website for due date. What to submit: Upload a tar archive that contains a text ?le answers.txt with your answers for the questions not requiring code, as well as individual ?les for those that do, as listed below. This exercise is intended to reinforce the content of the lectures related to linking using small examples. As some answers are speci?c to our current environment, you must again do this exercise on our rlogin cluster. Our veri?cation system will reject your submission if any of the required ?les are not in your submission. If you want to submit for a partial credit, you still need to include all the above ?les. 1CS3214 Fall 2018 Exercise 2 1.UnderstandingStaticLinking To understand the process of static linking of multiple relocatable object ?les (.o) ?les into a single executable, we ask that you do a recreational programming exercise that simu- lates what a real linker does. Your program will be given the concatenated symbol tables ofn .o ?les and it should output the symbol table of the resulting relocated executable. Consider the result of linking the following two .c ?les: #include “code.h” #include

static double data[20]; static int temp = -2; int main() { for (int i = 0; i < 20; i++) data[i] = i; temp = sum(data, 20); printf(“sum = %dn”, temp); printf(“inv = %dn”, invocationcount); } and #include “code.h” #include

int invocationcount; static int temp = -1; int sum(double data, int datalen) * { invocationcount++; int rc = 0; for (int i = 0; i < 20; i++) { temp = roundtoint(sin(data[i]) 5 – cos(data[i]) 10); * * rc += temp; } return rc; } If separately compiled (viagcc -std=gnu11 -c code1.c code2.c) two ?lescode1.o andcode2.o result. Using the commandnm -nS code1.o code2.o one obtains the following output, which will be the input to your simulated linker: code1.o: 2CS3214 Fall 2018 Exercise 2 U invocationcount U printf U sum 0000000000000000 00000000000000a0 b data 0000000000000000…

Attachments:

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.