Originally Posted by pnh73
I am trying to find out how I can get GCC to compile for a target with an assembly instruction set that I define.
Do you mean a brand new architecture (that you made up)? Or is this a common architecture that just happens to be different from the one your host machine is running?
If you’re talking about the latter case, you would create what’s caused a cross-toolchain. A toolchain is the combination of an assembler, a linker, a compiler, and (optionally) a C library. In the normal linux world, the first two come from binutils
and the second comes from gcc
. A cross-toolchain is one that “executes” on a host system, but compiles for a target system (which is presumably different from the host system). All the architectures here
(and maybe more) are supported by the latest binutils.
There are all sorts of guides for creating a cross-toolchain. Some examples off the top of my head are CLFS
build instructions. There are probably countless others.