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.
推荐答案
freestanding
环境是一种标准库可能不存在的环境,并且程序启动不一定在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屋!