什麼是gcc中的ffreestanding
?它是幹什麼用的 ?我遇到以下情況:gcc中的ffreestanding選項是什麼?
gcc -ffreestanding -m32 -c kernel.c -o kernel.o
並不明白,究竟是什麼意思。
什麼是gcc中的ffreestanding
?它是幹什麼用的 ?我遇到以下情況:gcc中的ffreestanding選項是什麼?
gcc -ffreestanding -m32 -c kernel.c -o kernel.o
並不明白,究竟是什麼意思。
A freestanding
環境是標準庫可能不存在的地方,程序啓動可能不一定是「主要」。選項-ffreestanding
指示編譯器而不是假定標準函數具有其通常的定義。
默認情況下,GCC將充當託管實現的編譯器,將__STDC_HOSTED__
定義爲1,並假定在使用ISO C函數的名稱時,它們具有標準中定義的語義。要使其充當適用於獨立環境的獨立式實施,請使用選件-ffreestanding
。然後它會將__STDC_HOSTED__
定義爲0,而不是對標準庫中函數名的含義做出假設。
欲瞭解更多信息,This鏈接可能會有所幫助。
請詳細說明 – saplingPro
@saplingPro請看編輯答案。 –
@Dayalrai我用'arm-non-eabi-gcc'使用'-wreestanding'選項:'arm-non-eabi-gcc -g -O0-terreestanding ......',但我仍然得到主符號調用'nm'命令'U main',這會產生我用'gdb'調試錯誤:'Function'main'not defined'。我怎樣才能避免產生這個'main'symbol – 2015-04-28 09:01:43
相關:http://stackoverflow.com/questions/2681304/compile-for-freestanding-environment-with-gcc –