当前位置:网站首页>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
边栏推荐
- There are three iPhone se 2022 models in the Eurasian Economic Commission database
- AMBA、AHB、APB、AXI的理解
- RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
- Pytoch implements simple linear regression demo
- JS object and event learning notes
- 高通&MTK&麒麟 手机平台USB3.0方案对比
- Come and walk into the JVM
- Encodermappreduce notes
- TypeScript
- 数据库面试常问的一些概念
猜你喜欢

共用体(union)详解【C语言】

优先级反转与死锁

STM32 how to locate the code segment that causes hard fault
![[template] KMP string matching](/img/f9/cd8b6f8e2b0335c2ec0a76fc500c9b.jpg)
[template] KMP string matching

ESP8266使用arduino连接阿里云物联网

R & D thinking 01 ----- classic of embedded intelligent product development process
![[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect](/img/e7/a0d4fc58429a0fd8c447891c848024.png)
[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect
![Detailed explanation of Union [C language]](/img/d2/99f288b1705a3d072387cd2dde827c.jpg)
Detailed explanation of Union [C language]

小天才电话手表 Z3工作原理

Come and walk into the JVM
随机推荐
ESP8266使用arduino连接阿里云物联网
Dependency in dependencymanagement cannot be downloaded and red is reported
The first simple case of GNN: Cora classification
[template] KMP string matching
数据分析之缺失值填充(重点讲解多重插值法Miceforest)
I2C总线时序详解
ESP学习问题记录
GNN的第一个简单案例:Cora分类
[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect
C语言回调函数【C语言】
SQL time injection
Reno7 60W super flash charging architecture
Come and walk into the JVM
MySQL START SLAVE Syntax
AMBA、AHB、APB、AXI的理解
【ESP32学习-2】esp32地址映射
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
E-commerce data analysis -- User Behavior Analysis
Pytorch four commonly used optimizer tests
Common regular expression collation