0

I was wondering if someone could explain the differences/similarities in processes between relocating PC-relative references and relocating absolute references.

The class I am currently in is a system designs class that is strictly taught in C, so I'm not sure why this is even relevant to the class.

  • 2
    Relative and absolute addresses are outside the scope of C-language standard. In other words, C "doesn't know" anything about those addresses. – barak manos Apr 28 '15 at 06:39
  • Yes, this question doesn't make any sense from a C perspective. You might want to retag it to assembler. – Lundin Apr 28 '15 at 06:40
  • Thanks for the tip. My class is taught in C, so I wasn't sure. – still_learning Apr 28 '15 at 06:44
  • It refers to **assembly** and whether you are addressing **within a single data segment** or **across multiple segments**. Relative address are for use **within a single segment**. How that matters in **C** is a bit dubious. – David C. Rankin Apr 28 '15 at 06:44
  • Some symbols (non-static local variables) in your program are replaced by the compiler with addresses that are relative to the value of the stack-pointer. Other symbols (static local variables, static global variables and non-static global variables) are replaced by the compiler with addresses that are absolute. In fact, even those addresses are not really absolute, as they are relative to the base-address of the process which is created every time the program is loaded into memory and executed. The actual logical-to-physical translation is perform by the HW (namely, the MMU). – barak manos Apr 28 '15 at 06:47
  • But again - all of that has nothing to do with C. – barak manos Apr 28 '15 at 06:47
  • He has both the `assembly` and `C` tags. For this question, it looks like the `C` tag should be removed. He is probably looking for the explanation of **offset** within a segment relative reference or **segment:offset** as the absolute reference. Agreed, it doesn't relate to `C` other than compiler design and compiler address handling that is completely transparent to the user. – David C. Rankin Apr 28 '15 at 06:51
  • Sorry for messing up with the tags. The teacher provided us with keywords on what we should know for our midterm, and I was unfamiliar with this one. Very helpful explanations though. I'll ask him why we need to know this for C tomorrow, I guess. – still_learning Apr 28 '15 at 06:56
  • Take a look at the following (mid page). It is a decent reference [**Assembly Language Tutorial (x86)**](http://www.hep.wisc.edu/~pinghc/x86AssmTutorial.htm). – David C. Rankin Apr 28 '15 at 06:59

0 Answers0