gcc中的ffreestanding选项是什么? [英] What is ffreestanding option in gcc?
问题描述
在gcc中 ffreestanding
是什么?它用于什么?我遇到了以下问题:
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.
推荐答案
独立的
环境是标准库可能不存在,程序启动不一定在main的环境。选项 -ffreestanding
指示编译器不是假设标准函数有其通常的定义。
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.
默认情况下,GCC将作为托管实现的编译器,将 __ STDC_HOSTED __
定义为1,并假设当使用ISO C函数的名称时,语义在标准中定义。要使其成为独立式环境的合适独立实现,请使用选项 -ffreestanding
。然后它将 __ STDC_HOSTED __
定义为0,而不是假设标准库中的函数名的含义。
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.
这篇关于gcc中的ffreestanding选项是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!