国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

arm-linux-gnueabihf-g++ gcc編譯、優(yōu)化命令 匯總

這篇具有很好參考價值的文章主要介紹了arm-linux-gnueabihf-g++ gcc編譯、優(yōu)化命令 匯總。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

gcc優(yōu)化選項,可在編譯時間,目標(biāo)文件長度,執(zhí)行效率三個維度,進行不同的取舍和平衡。

gcc 常用編譯選項

arm-linux-gnueabihf-g++ -O3 -march=armv7-a -mcpu=cortex-a9 -ftree-vectorize -mfpu=neon -mfpu=vfpv3-fp16 -mfloat-abi=hard -ffast-math 

-c 只編譯并生成目標(biāo)文件。
-E 只運行 C 預(yù)編譯器。
-g 生成調(diào)試信息。GNU 調(diào)試器可利用該信息。
-Os 相對語-O2.5。
-o FILE 生成指定的輸出文件。用在生成可執(zhí)行文件時。
-O0 不進行優(yōu)化處理。
-O 或 -O1 優(yōu)化生成代碼。
-O2 進一步優(yōu)化。
-O3 比 -O2 更進一步優(yōu)化,包括 inline 函數(shù)。
-shared 生成共享目標(biāo)文件。通常用在建立共享庫時。
-W 開啟所有 gcc 能提供的警告。
-w 不生成任何警告信息。
-Wall 生成所有警告信息。

優(yōu)化O0,O, O2, O3

These options control various sorts of optimizations.

Without any optimization option, the compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code.

Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program.

The compiler performs optimization based on the knowledge it has of the program. Using the -funit-at-a-time flag will allow the compiler to consider information gained from later functions in the file when compiling a function. Compiling multiple files at once to a single output file (and using -funit-at-a-time) will allow the compiler to use information gained from all of the files when compiling each of them.

Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed.

-O0

-O0: 不做任何優(yōu)化,這是默認(rèn)的編譯選項。

-O1

-O1:優(yōu)化會消耗少多的編譯時間,它主要對代碼的分支,常量以及表達(dá)式等進行優(yōu)化。

-O和-O1: 對程序做部分編譯優(yōu)化,對于大函數(shù),優(yōu)化編譯占用稍微多的時間和相當(dāng)大的內(nèi)存。使用本項優(yōu)化,編譯器會嘗試減小生成代碼的尺寸,以及縮短執(zhí)行時間,但并不執(zhí)行需要占用大量編譯時間的優(yōu)化。 -O1打開的優(yōu)化選項, 可參考最后的參考文獻(xiàn)。
Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.
With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.

-O turns on the following optimization flags:

      -fdefer-pop 
      -fmerge-constants 
      -fthread-jumps 
      -floop-optimize 
      -fif-conversion 
      -fif-conversion2 
      -fdelayed-branch 
      -fguess-branch-probability 
      -fcprop-registers

-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging.

-O2

-O2:會嘗試更多的寄存器級的優(yōu)化以及指令級的優(yōu)化,它會在編譯期間占用更多的內(nèi)存和編譯時間。
Gcc將執(zhí)行幾乎所有的不包含時間和空間折中的優(yōu)化。當(dāng)設(shè)置O2選項時,編譯器并不進行循環(huán)打開()loop unrolling以及函數(shù)內(nèi)聯(lián)。
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify -O2. As compared to -O, this option increases both compilation time and the performance of the generated code.
-O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags:

      -fforce-mem 
      -foptimize-sibling-calls 
      -fstrength-reduce 
      -fcse-follow-jumps  -fcse-skip-blocks 
      -frerun-cse-after-loop  -frerun-loop-opt 
      -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las 
      -fdelete-null-pointer-checks 
      -fexpensive-optimizations 
      -fregmove 
      -fschedule-insns  -fschedule-insns2 
      -fsched-interblock  -fsched-spec 
      -fcaller-saves 
      -fpeephole2 
      -freorder-blocks  -freorder-functions 
      -fstrict-aliasing 
      -funit-at-a-time 
      -falign-functions  -falign-jumps 
      -falign-loops  -falign-labels 
      -fcrossjumping

Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos.

-O3

-O3: 在O2的基礎(chǔ)上進行更多的優(yōu)化。例如使用偽寄存器網(wǎng)絡(luò),普通函數(shù)的內(nèi)聯(lián),以及針對循環(huán)的更多優(yōu)化。在包含了O2所有的優(yōu)化的基礎(chǔ)上,又打開了以下優(yōu)化選項:
l -finline-functions:內(nèi)聯(lián)簡單的函數(shù)到被調(diào)用函數(shù)中。
l -fweb:構(gòu)建用于保存變量的偽寄存器網(wǎng)絡(luò)。 偽寄存器包含數(shù)據(jù), 就像他們是寄存器一樣, 但是可以使用各種其他優(yōu)化技術(shù)進行優(yōu)化, 比如cse和loop優(yōu)化技術(shù)。這種優(yōu)化會使得調(diào)試變得更加的不可能,因為變量不再存放于原本的寄存器中。
l -frename-registers:在寄存器分配后,通過使用registers left over來避免預(yù)定代碼中的虛假依賴。這會使調(diào)試變得非常困難,因為變量不再存放于原本的寄存器中了。
l -funswitch-loops:將無變化的條件分支移出循環(huán),取而代之的將結(jié)果副本放入循環(huán)中。

-Os

-Os:相當(dāng)于-O2.5。是使用了所有-O2的優(yōu)化選項,但又不縮減代碼尺寸的方法。
Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
-Os disables the following optimization flags:

      -falign-functions  -falign-jumps  -falign-loops 
      -falign-labels  -freorder-blocks  -fprefetch-loop-arrays

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.文章來源地址http://www.zghlxwxcb.cn/news/detail-654126.html

Reference

  1. gcc Options That Control Optimization
  2. gcc編譯優(yōu)化-O0 -O1 -O2 -O3 -OS說明

到了這里,關(guān)于arm-linux-gnueabihf-g++ gcc編譯、優(yōu)化命令 匯總的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 交叉編譯器 arm-linux-gnueabi 和 arm-linux-gnueabihf 的區(qū)別

    自己之前一直沒搞清楚這兩個交叉編譯器到底有什么問題,特意google一番,總結(jié)如下,希望能幫到道上和我有同樣困惑的兄弟…… ABI: 二進制應(yīng)用程序接口(Application Binary Interface (ABI) for the ARM Architecture) 在計算機中,應(yīng)用二進制接口描述了應(yīng)用程序(或者其他類型)和操作系統(tǒng)之

    2024年04月11日
    瀏覽(31)
  • 交叉編譯工具鏈arm-linux-gnueabihf的安裝-ubuntu 20.04

    http://t.csdn.cn/ZbjFX 建議直接在.bashrc文件作修改 ,修改方式相同 ( vi :視自己的編輯器而定) 因為我在修改profile文件后,環(huán)境變量生效,但是命令行的用戶名等顏色高亮顯示會消失;并且重啟終端后,又需要再source一下profile。 但是將環(huán)境變量添加至.bashrc則不會出現(xiàn)這兩個問題

    2024年02月11日
    瀏覽(62)
  • Ubuntu上搭建ARM Linux GCC交叉編譯環(huán)境

    在Ubuntu操作系統(tǒng)上搭建ARM Linux GCC交叉編譯環(huán)境是為了能夠在x86架構(gòu)的主機上編譯運行適用于ARM架構(gòu)的程序。本文將介紹詳細(xì)的步驟以及相應(yīng)的源代碼。 安裝必要的軟件包 首先,我們需要安裝一些必要的軟件包,包括GCC、GNU Binutils和GDB。打開終端,運行以下命令來安裝這些軟

    2024年02月02日
    瀏覽(32)
  • 【ARM 嵌入式 編譯系列 2.1 -- GCC 預(yù)處理命令 #error 和 #warning 詳細(xì)介紹 】

    在C語言中, #error 和 #warning 預(yù)處理指令可以用于在編譯時生成錯誤或警告信息,通常用于調(diào)試或當(dāng)代碼中某些條件未滿足時提醒開發(fā)者。當(dāng)這些指令被編譯器處理時,會自動包含出現(xiàn)這些指令的文件名和行號,所以你可以清楚地看到問題出現(xiàn)的位置。 #error 當(dāng)編譯器遇到 #e

    2024年01月22日
    瀏覽(65)
  • arm-linux-gcc 找不到命令?

    arm-linux-gcc 找不到命令?

    2024年02月12日
    瀏覽(24)
  • Ubuntu 22.04 搭建arm-linux-gcc交叉編譯環(huán)境

    Ubuntu 22.04 搭建arm-linux-gcc交叉編譯環(huán)境

    如果使用的是64位的Ubuntu系統(tǒng),建議直接安裝64位的arm-linux-gcc交叉編譯器 下載地址: https://pan.baidu.com/s/14-lQpsXuEyCcHNHcTXcOyA 提取碼: 55at 0. 注意在終端進行粘貼的操作為【Ctrl+shift+v】?。?把下載好的安裝包移動到根目錄下的tmp目錄中(/tmp):在【其他位置】中的【計算機】中找

    2024年02月05日
    瀏覽(42)
  • Linux GCC常用命令以及GCC編譯器

    GCC 是編譯工具,它的意思是 GNU C Compiler 。經(jīng)過了這么多年的發(fā)展,GCC 已經(jīng)不僅僅能支持 C 語言;它現(xiàn)在還支持 Ada 語言、C++ 語言、Java 語言、Objective C 語言、Pascal 語言、COBOL語言,以及支持函數(shù)式編程和邏輯編程的 Mercury 語言等等。而 GCC 也不再單只是 GNU C 語言編譯器的意

    2024年02月05日
    瀏覽(32)
  • 下載較老版本或最新版本的ARM Linux gcc 交叉編譯工具鏈

    下載較老版本或最新版本的ARM Linux gcc 交叉編譯工具鏈

    如果開發(fā)的 ARM 平臺比較的多,需要多個版本的 arm gcc 交叉編譯工具鏈,那么如何獲取較新版本的 arm gcc 交叉編譯工具鏈呢? 速度較快的,也比較新的,就到 ARM 官方網(wǎng)站下載 下載地址: https://developer.arm.com/downloads/-/gnu-a GNU-A Downloads 最新的下載地址: https://developer.arm.com/do

    2024年02月14日
    瀏覽(33)
  • [linux]Ubuntu 18.04安裝arm-linux-gcc交叉編譯器的兩種方法

    [linux]Ubuntu 18.04安裝arm-linux-gcc交叉編譯器的兩種方法

    第一種:apt安裝法: Ctrl+Alt+T彈出終端,使用如下命令進行arm-linux-gcc的安裝: ??使用如下命令進行arm-linux-g++的安裝: ??如果要卸載時使用如下命令進行移除,arm-linux-gcc的卸載: ??arm-linux-g++的卸載: ?第二種源碼安裝: 目前網(wǎng)上搜索發(fā)現(xiàn),最多人安裝的是4.4.3版本的

    2024年02月05日
    瀏覽(24)
  • arm-linux-gnueabihf工具安裝

    比如[gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz],主要問題就是非常慢(https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz) 先解壓 將當(dāng)前的bin目錄添加到環(huán)境變量中,使用命令pwd 環(huán)境變量生效 查看設(shè)置的路徑,

    2024年02月12日
    瀏覽(17)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包