Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is -ffreestanding option in gcc?

What is ffreestanding in gcc ? What is it used for ? I came across the following :

gcc -ffreestanding -m32 -c kernel.c -o kernel.o 

and do not understand, what does it mean exactly.

like image 763
saplingPro Avatar asked Jul 17 '13 06:07

saplingPro


People also ask

What does option in GCC do?

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.

What is option in compiler?

clause. Compilers options (− x on Linux, and /Qx on Microsoft Windows) control which instructions the compiler uses within a function, while the processor(…) clause controls creation of non-standard functions using wider registers (YMM or ZMM) for passing SIMD data for parameters and results. The processor(…)

What is GCC C option?

-c will instruct gcc to only compile the source file to an .o (object) file but does not invoke the linker. With a project containing many . c files one will typically compile first all . c files to .o files and then link everything together with the libraries.

What is Option G ++?

The g++ Compiler Without this option, g++ creates an executable file. With this option, it creates an object file. If no output file name is given (by option -o), the object file name for file prog.


1 Answers

A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at "main". The option -ffreestanding directs the compiler to not assume that standard functions have their usual definition.

By default, GCC will act as the compiler for a hosted implementation, defining __STDC_HOSTED__ as 1 and presuming that when the names of ISO C functions are used, they have the semantics defined in the standard. To make it act as a conforming freestanding implementation for a freestanding environment, use the option -ffreestanding. It will then define __STDC_HOSTED__ to 0, and not make assumptions about the meanings of function names from the standard library.

For more Info, This link may help.

like image 194
Dayal rai Avatar answered Sep 26 '22 08:09

Dayal rai