Question

in c/c++ program: 1. The differences between symbol relocation and symbol resolution. 2. Why is it...

in c/c++ program:

1. The differences between symbol relocation and symbol resolution.

2. Why is it a good idea to have multiple object files as opposed to just one?

3.

Homework Answers

Answer #1

1. Answer: Difference between Symbol relocation vs Symbol Resolution

Symbol resolution: Symbol resolution means to find the definition of undefined reference in an object file.

Ex: let say we have two file main.c and swapnumber.c

main.c   

int num[2] = {5,6};

int main(){

swapnumber();

}

The use of swapnumber() in main.o needs to be resolved to definition found in swapnumber.o

Symbol relocation: It is a process of assigning an absolute address to the code and data.

Ex: swapnumber.c

extern int num[];

void swapnumber(){

int temp;

temp = num[1];

int num[1] = num[0];

num[0] = temp;

}

here swapnumber.c compiled without knowing about num, it is the responsibility of the linker to allocate memory and update uses of num in swapnumber.o to use this location.

2. Answer: Multiple objects file optimize the performance of a compiler. The separate unit compilation is faster than a single object file. Let say we are working on a large project and we did a few changes in the code of the project than we need to compile the entire file and a new object file will be created. This makes the compiler slow. If we have multiple object files of a large project than if we change the code in one of the files, then it is easy to create an object of the smaller file rather than a whole project at once.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
JAVA PROGRAMMING: Write a program called TimeSymbolTables that creates three symbol tables, each of a different...
JAVA PROGRAMMING: Write a program called TimeSymbolTables that creates three symbol tables, each of a different implementation. Each symbol table will contain as a key a word read from a text file and as a value the number of times that word occurs in the text file. Have the program fill the first symbol table with these counts, keeping track of how long that takes using a Stopwatch object. It then does the same thing with the second symbol table....
Could the purported cognitive differences between men and women be due to differences in cognitive style?...
Could the purported cognitive differences between men and women be due to differences in cognitive style? Why? 2.    To what extent does society and rules about social norms affect cognitive differences between men and women? 3.    Many people have a preferred way of learning. Some prefer to learn by reading independently, others prefer to learn by listening to a lecture, and yet others prefer to learn by doing. What do you believe is the best way to deliver a course...
1) Identify differences between NSAIDs and acetaminophen 2) Identify additional nonpharmacological intervnetions that could be used...
1) Identify differences between NSAIDs and acetaminophen 2) Identify additional nonpharmacological intervnetions that could be used to treat inflammation, particularly conditions that are chronic such as arthritis 3) Differntiate between process of resolution and regeneration. What factors determine which of these processes will occur following an injury?
1. List the similarities AND differences between the structures of phosphoglycerides and sphingolipids 2. List the...
1. List the similarities AND differences between the structures of phosphoglycerides and sphingolipids 2. List the similarities AND differences between the structures of sphingolipids and glycolipids 3. Are sterols amphipathic, why or why not?
1. What are the differences between planned contrasts (or planned comparisons) and post hoc tests? Why...
1. What are the differences between planned contrasts (or planned comparisons) and post hoc tests? Why are they used after performing a one-way ANOVA? How do you decide which to use of the two types of follow-up tests? 2. What are the main differences between between- and within-groups one-way ANOVAs? What determines which type of test should be used? Which is a stronger test and why?
This program will output a right triangle based on user specified height triangle_height and symbol triangle_char....
This program will output a right triangle based on user specified height triangle_height and symbol triangle_char. (1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangle_char character. (1 pt) (2) Modify the program to use a loop to output a right triangle of height triangle_height. The first line will have one user-specified character, such as % or *. Each subsequent line will have...
What are the differences between a type 1 and type 2 error. Which is worse and...
What are the differences between a type 1 and type 2 error. Which is worse and why?
1. List the differences between the cells in Prophase I and Prophase II. 2. List the...
1. List the differences between the cells in Prophase I and Prophase II. 2. List the differences between the cells in Metaphase 1 and Metaphase II. 3. List the differences between the cells in Anaphase I and Anaphase II. 4. List the differences between the cells in Telophase I and Telophase II.
Write a program in java that: 1. takes any number in any base between 2 and...
Write a program in java that: 1. takes any number in any base between 2 and 16 and converts it to base 10. 2. converts base 10 numbers to any given base between 2 & 16. The program should have a gui with an input box and two buttons, one button to convert any base between 2 and 16 to base 10; and one button to convert base 10 to any base between 2 and 16. **Please DO NOT upload...
1) What are the differences between a bar graph and a histogram. 2) A scatter plot...
1) What are the differences between a bar graph and a histogram. 2) A scatter plot describes a graph of bivariate data. If strong correlation exists between the 2 variables, does that mean that one causes the other? Explain. 3) A scatter plot describes a graph of bivariate data. If there's weak correlation exists between the 2 variables, does that mean that one causes the other? Explain.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT