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.
推荐答案
一个独立的环境
可能不存在标准库,并且程序启动不一定位于主环境中。选项 -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屋!