Fail-Safe C: Usage


Compiling single file, or multiple files

The driver “fscc” can be used just in the common compiler interface. For example, the command

 fscc -o hello hello.c

compiles the source file “hello.c” and output the executable file to the file “hello”.

If your project has multiple file, you can use compiler and linker separately, like

 fscc -c main.c
 fscc -c libmine.c
 fscc -o myprogram main.o libmine.o

and the driver will call either the compiler and the linker appropriately.

Recognized options

Current driver and compiler understands the following standard options.

-o
Specify the name of the final output file.
-c
Stop process after compilation: no linking.
-E
Stop process after preprocessor: no compilation, no linking.
-Idir
Add the directory dir to the search path of the include files.
-Ldir
Add the directory dir to the search path of the library files.
-lfile
Add the library file libfile.a in the library search path to be linked.
-g
Generating debugging code. It emit very slow executive, but several debugging/assertion features are enabled. Note: if -g is used for compilation, it is also needed for linking.
-Dsymbol
Define the symbol for the preprocessor.
-Usymbol
Define the symbol for the preprocessor.

In addition to above, the compiler also accepts the following non-standard options.

--safec-only
Stop process after Fail-Safe C processing. Backend native code generation is not performed. Output file extension will be “.safe.c”.
--save-temps
Keep all intermediately generated files in the current directory. Useful if you want to use debuggers.
-Wc,opts
Pass options opts to the backend native code generator (gcc).
-Wl,opts
Pass options opts to the backend native code linker.
-fopts
specify some options for compilers.

Tips

Use with GNU AUTOCONF

Current version of the Fail-Safe C Compiler supports basic use of GNU AUTOCONF. However, due to dirty tricks used by AUTOCONF, it needs special workaround. Usually, invoking the configure with the following options may work:

 env CC=/path/to/fscc CFLAGS='-fgnu-autoconf-workaround' \
     ./configure --build=i386-linux

Notes

  • Current support for standard-library functions are limited. See this page for current status and future plan.
  • Some programs may fail accessing 4294967295th or 4294967292nd offset of the memory. This is because the programs incorrectly uses address of the -1st element of arrays as a guardian. It can be workaround by specifying -fptr-compare-signed-offset to the compiler.