当前位置:网站首页>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
边栏推荐
- Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries
- There are three iPhone se 2022 models in the Eurasian Economic Commission database
- Gallery之图片浏览、组件学习
- C语言,log打印文件名、函数名、行号、日期时间
- Unit test - unittest framework
- SQL time injection
- Missing value filling in data analysis (focus on multiple interpolation method, miseforest)
- Characteristics, task status and startup of UCOS III
- Detailed explanation of 5g working principle (explanation & illustration)
- ESP8266使用arduino连接阿里云物联网
猜你喜欢
R & D thinking 01 ----- classic of embedded intelligent product development process
open-mmlab labelImg mmdetection
电商数据分析--薪资预测(线性回归)
Word typesetting (subtotal)
Stage 4 MySQL database
程序员老鸟都会搞错的问题 C语言基础 指针和数组
AMBA、AHB、APB、AXI的理解
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
【ESP32学习-1】Arduino ESP32开发环境搭建
高通&MTK&麒麟 手机平台USB3.0方案对比
随机推荐
GNN的第一个简单案例:Cora分类
MongoDB
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries
FreeRTOS 任务函数里面的死循环
Wangeditor rich text component - copy available
JS array + array method reconstruction
Gallery's image browsing and component learning
XML文件详解:XML是什么、XML配置文件、XML数据文件、XML文件解析教程
Missing value filling in data analysis (focus on multiple interpolation method, miseforest)
【ESP32学习-1】Arduino ESP32开发环境搭建
优先级反转与死锁
ESP8266使用arduino连接阿里云物联网
Detailed explanation of Union [C language]
Several declarations about pointers [C language]
Word排版(小計)
列表的使用
Implementation scheme of distributed transaction
There are three iPhone se 2022 models in the Eurasian Economic Commission database
ESP8266通过arduino IED连接巴法云(TCP创客云)
C language, log print file name, function name, line number, date and time