This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiler porting


> Date: Mon, 27 Aug 2001 18:22:50 -0400 (EDT)
> From: Luke Beaulieu <lukeb@canal.iaw.on.ca>
> To: gcc@gcc.gnu.org

> I have a question regarding porting a compiler to a new
> platform. I've asked many people, including some of my professors at
> university, and nobody can answer it.

Almost anyone can answer it, some just don't want to spend the time.

> How do your port a compiler to a platform (either a new CPU or a new
> OS) when there doesn't exist a compiler for that platform?

Not quite the right place, but, heck, I'll answer...

Given documentation for the platform you are interested in, you sit
down, and read and understand the porting guides of the tools
(compiler and binutils), and then implement it.  You compile up
snippets of code to make sure you're on the right track and finally,
you compile up large amounts of software to get some of the bugs out.
If or when you have a simulation environment or real hardware, you can
_then_ do testing on the system and work out the remaining bugs.

The existence of hardware or software isn't necessary for the initial
port.  Certainly, it is not uncommon for engineers to port gcc and
binutils having absolutely nothing except for a paper document.

If you want experience on how it is done, try it once.  Find a random
CPU variant or a random CPU instruction that isn't supported by the
tools, and implement support for it.  After you do it once, you will
have a better idea what the rest of us do.

If you want to cheat, take an existing port, remove 5 instructions,
and then implement support for them, without looking at what you
removed and only by reading documentation.  The whole chip, is just
like that, just 40-400 times harder.

I come from a learning-by-doing school, in case you could not tell.

Followups to me personally, I don't think much else along these lines
should go to the whole list and I cannot suggest a better place.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]