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
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?
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...
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.
A school counselor in a high school would like to try out a new conflict-resolution program...
A school counselor in a high school would like to try out a new conflict-resolution program to reduce aggressiveness in students. She first surveyed 16 students using a 20-item instrument to measure their levels of aggression (on a scale of 0 to 10, with higher numbers meaning higher aggression levels). One month after the conflict resolution program was implemented, the students were given the same survey. The data are listed in the table below. The school counselor/researcher has set the...
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.
write a C++ program that display a prime numbers between 1 and 100 number. Plase print...
write a C++ program that display a prime numbers between 1 and 100 number. Plase print the remaining primes by “dots” For gexample The output should appear like The prime numbers between 1 and 100 are: 1, 2, 3, 5, 7, .........
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT