The code I'm working on is supposed to be possible to build for both hosted and freestanding environments, providing private implementations for some stdlib functions for the latter case.

Can I reliably test this with just GCC on a normal workstation/build server? Compile for freestanding environment with GCC

  • The "-ffreestanding" option looked promising, but it seems that it "only" disables built-ins and sets the STDC_HOSTED macro properly, it still provides all system headers.

  • The option "-nostdinc" is too restrictive; I still want to use the headers required for a freestanding implementation (in particular stddef.h and limits.h).

What am I missing here?

Oh, and I'm using GCC 4.4.3 for the moment, will upgrade to 4.5.0 "soon".

Edit
Report