当前位置:网站首页>GCC compilation options
GCC compilation options
2022-07-06 12:01:00 【csdndulala】
-fno-builtin Do not use built-in functions
-ffunction-sections
-fdata-sections
demand : Some functions or variables do not need to be programmed when they are not used
GCC The link operation is based on section As the smallest processing unit , As long as a section A symbol in is referenced , The section Will be added to the executable program . therefore ,GCC You can use -ffunction-sections and -fdata-sections Create each function or symbol as a sections, Each of them sections Name and function or data Keep the names the same . And in the link phase , -Wl,–gc-sections Instructs the linker to remove unused section( among -Wl, Represents the following parameter -gc-sections Pass it to the linker ), This reduces the size of the final executable .
We often use the following configuration to enable this function :
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -Wl,–gc-sections-Wall Discover a series of common error warnings in the program
-D Defining macro
-DMACRO In string “1” Definition MACRO macro .
-DMACRO=DEFN In string “DEFN” Definition MACRO macro .-O Optimize registration
O0 -->> O1 -->> O2 -->>Os–>> O3
-O0 No optimization ,-O1 Is the default value ,-O3 The highest level of optimization
https://blog.csdn.net/zzhongcy/article/details/91445924mabi Specify the data model and floating-point parameter transfer rules
https://blog.csdn.net/zoomdy/article/details/79353313-nostartfiles When connecting, do not use the startup file of the standard system
https://my.oschina.net/saly/blog/130920-T,–script=: Use scriptfile As linker scripts . This script will replace ld Default linker script for ( Instead of adding to it ), So the script has to specify everything that is required for the output file . If there is no script file in the current directory ,“ld” Will be in -L Search in the directory specified by the
[email protected] Target file ,$^ All dependent files ,$< The first dependency file
give an example gcc -o main main.o
Equivalent gcc -o [email protected] $^-lm Option tells the compiler , The mathematical functions used in our program should reach libm.so Look in the library file
( for example printf) be located libc.so Library file , Use libc.so The library functions in do not need to be added at compile time -lc Options , Because this option is gcc Default options
边栏推荐
- 电商数据分析--薪资预测(线性回归)
- XML file explanation: what is XML, XML configuration file, XML data file, XML file parsing tutorial
- Reno7 60W超级闪充充电架构
- 小天才电话手表 Z3工作原理
- Gallery's image browsing and component learning
- Pytoch implements simple linear regression demo
- Gallery之图片浏览、组件学习
- There are three iPhone se 2022 models in the Eurasian Economic Commission database
- 5G工作原理详解(解释&图解)
- C language callback function [C language]
猜你喜欢
Principle and implementation of MySQL master-slave replication
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
数据分析之缺失值填充(重点讲解多重插值法Miceforest)
Correspondence between STM32 model and contex M
Priority inversion and deadlock
Missing value filling in data analysis (focus on multiple interpolation method, miseforest)
arduino JSON数据信息解析
Mysql的索引实现之B树和B+树
Time slice polling scheduling of RT thread threads
STM32型号与Contex m对应关系
随机推荐
機器學習--線性回歸(sklearn)
Kaggle competition two Sigma connect: rental listing inquiries
Come and walk into the JVM
C语言,log打印文件名、函数名、行号、日期时间
树莓派 轻触开关 按键使用
2020 WANGDING cup_ Rosefinch formation_ Web_ nmap
[Kerberos] deeply understand the Kerberos ticket life cycle
Pytoch implements simple linear regression demo
Variable parameter principle of C language function: VA_ start、va_ Arg and VA_ end
Raspberry pie tap switch button to use
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
互联网协议详解
Some concepts often asked in database interview
Missing value filling in data analysis (focus on multiple interpolation method, miseforest)
List and set
Reno7 60W super flash charging architecture
Keyword inline (inline function) usage analysis [C language]
Pytoch temperature prediction
[Presto] Presto parameter configuration optimization
Wangeditor rich text reference and table usage