Take the 2-minute tour ×
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

I'm currently learning for an exam about compilers and found the following question:

(3 p.) Bootstrapping: Explain the concepts of rehosting and retargeting. Use T-diagrams.

As far as I understand, rehosting means to compile a compiler for another platform (host), so it should look like this:

-------------
| a       b |     --------------
-----   -----     | a        b |
    | c |-------------    ------
    -----| c       x || x |
         -----   ----------
             | ? |
             -----

Is this correct? And what does retargeting mean?

share|improve this question

2 Answers 2

Retargeting refers to having the compiler generate code for a different CPU or instruction set.
A different CPU would be X86 vs PowerPC.
A different instruction set would be ARM vs THUMB or x86 vs x86-64 (same CPU, but different mode).

Rehosting means running the code on a different machine than the code was compiled on.
The new machine usually has the same architecture.
Rehosting need not be trivial, because e.g. the filesystem may look different on the compiler system.

See: http://www.cs.southern.edu/halterman/Courses/Spring2009/425/Slides/ch11.pdf

Retargetability
Easily modified to generate code for a different target language

Rehostability
Easily modified to run on a different machine

Collectively the two terms are often combined in the term portability.
Code that is portable is not tied to an architecture (target) and not tied to the setup of a specific machine (host).

refering to your question
Rehosting does not mean compiling for another platform!
Retargeting is compiling for another platform.
Rehosting is moving your program to another computer (same platform) (and keeping your fingers crossed to see if it works)

share|improve this answer

? should be replaced by x, see these lecture notes.

Rehosting: your target machine is fixed and you simply run the compiler to achieve the machine code. Example, a C compiler for intel x86 processor.

Retarget: you want flexibility for your compiler and need to cross-compile it using another compiler and therefore, "Target" it for different machine than which was originally intended for.

(I am feeling a bit strange as this is how I have justified the lecuture to myself :P). For all intents and purposes, I am more than happy to get a slap on the wrist for a wrong answer :

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.