Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the smallest, simplest CPU that GCC can compile for?

Tags:

gcc

emulation

cpu

In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it.

like image 854
Tamás Szelei Avatar asked Jan 27 '11 14:01

Tamás Szelei


People also ask

What is Mcmodel GCC?

From GCC reference: -mcmodel=small Generate code for the small code model: the program and its symbols must be linked in the lower 2 GB of the address space. Pointers are 64 bits. Programs can be statically or dynamically linked. This is the default code model.

What does March native do?

Using -march=native enables all instruction subsets supported by the local machine (hence the result might not run on different machines). Using -mtune=native produces code optimized for the local machine under the constraints of the selected instruction set. A generic CPU with 64-bit extensions.

What is GCC march?

The GCC documentation is clear: -march=cpu-type allows GCC to generate code that may not run at all on processors other than the one indicated. The other flag (“-mtune”) is just an optimization hint, e.g., if you write “-mtune=haswell”, you tell the compile to generate code that runs best on “haswell”-type processors.

How do I specify architecture in GCC?

If gcc -v shows GCC was configured with a --with-arch option (or --with-arch-32 and/or --with-arch-64 ) then that's what will be the default. Without a --with-arch option (and if there isn't a custom specs file in use) then the arch used will be the default for the target.


1 Answers

Moxie is a great target because it was designed specifically to be an ideal target for GCC. I am the author and would be happy to answer any questions. green at moxielogic dot com

like image 182
Anthony Green Avatar answered Oct 05 '22 03:10

Anthony Green