How to make GCC target my own CPU?
Segher Boessenkool
segher@kernel.crashing.org
Fri Sep 18 12:40:20 GMT 2026
Hi!
On Thu, Sep 17, 2026 at 01:28:47PM +0200, jf84ut--- via Gcc-help wrote:
> I'd like to patch gcc so that it will target a CPU that I've designed. I
> can't find a page on exactly how to approach this project. Can you refer
> me to any documents?
The internals manual ("gccint") is a good place to start, and especially
the machine decription stuff:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Desc.html
I've written many new targets in the last N years (N~10, not sure how
long exactly, nor how many targets), and my biggest advice is to *not*
start of with some existing target. Instead, start with an empty file.
You'll end up with way less lint. It will still be obvious what you are
missing, and there won't be distracting old stuff :-)
Segher
More information about the Gcc-help
mailing list