当前位置:网站首页>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
边栏推荐
- Reading notes of difficult career creation
- E-commerce data analysis -- User Behavior Analysis
- JS array + array method reconstruction
- A possible cause and solution of "stuck" main thread of RT thread
- 优先级反转与死锁
- 高通&MTK&麒麟 手機平臺USB3.0方案對比
- Reno7 60W super flash charging architecture
- OPPO VOOC快充电路和协议
- ESP8266使用arduino连接阿里云物联网
- Analysis of charging architecture of glory magic 3pro
猜你喜欢

FTP file upload file implementation, regularly scan folders to upload files in the specified format to the server, C language to realize FTP file upload details and code case implementation
![Detailed explanation of Union [C language]](/img/d2/99f288b1705a3d072387cd2dde827c.jpg)
Detailed explanation of Union [C language]

机器学习--线性回归(sklearn)

Detailed explanation of 5g working principle (explanation & illustration)

PyTorch四种常用优化器测试
![Several declarations about pointers [C language]](/img/9b/ace0abbd1956123a945a98680b1e86.png)
Several declarations about pointers [C language]

Unit test - unittest framework

Gallery之图片浏览、组件学习

【ESP32学习-1】Arduino ESP32开发环境搭建

Vert. x: A simple TCP client and server demo
随机推荐
共用体(union)详解【C语言】
ESP8266使用arduino连接阿里云物联网
Composition des mots (sous - total)
機器學習--線性回歸(sklearn)
Those commonly used tool classes and methods in hutool
[mrctf2020] dolls
Principle and implementation of MySQL master-slave replication
C language, log print file name, function name, line number, date and time
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries(XGBoost)
[yarn] CDP cluster yarn configuration capacity scheduler batch allocation
小天才电话手表 Z3工作原理
Inline detailed explanation [C language]
Contiki源码+原理+功能+编程+移植+驱动+网络(转)
[yarn] yarn container log cleaning
Implementation scheme of distributed transaction
RT thread API reference manual
使用LinkedHashMap实现一个LRU算法的缓存
uCOS-III 的特点、任务状态、启动
Wangeditor rich text component - copy available
Variable star user module