当前位置:网站首页>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
边栏推荐
- I2C总线时序详解
- Several declarations about pointers [C language]
- 锂电池基础知识
- Those commonly used tool classes and methods in hutool
- Gallery's image browsing and component learning
- Composition des mots (sous - total)
- uCOS-III 的特点、任务状态、启动
- Linux Yum install MySQL
- [Flink] Flink learning
- Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
猜你喜欢
荣耀Magic 3Pro 充电架构分析
Redis interview questions
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
Linux yum安装MySQL
ESP学习问题记录
R & D thinking 01 ----- classic of embedded intelligent product development process
IOT system framework learning
【ESP32学习-2】esp32地址映射
Fashion-Gen: The Generative Fashion Dataset and Challenge 论文解读&数据集介绍
Priority inversion and deadlock
随机推荐
SQL time injection
Mysql database interview questions
[mrctf2020] dolls
Bubble sort [C language]
Wangeditor rich text component - copy available
Pytorch实现简单线性回归Demo
嵌入式启动流程
Inline detailed explanation [C language]
vim命令行笔记
Vert. x: A simple login access demo (simple use of router)
Yarn installation and use
arduino UNO R3的寄存器写法(1)-----引脚电平状态变化
高通&MTK&麒麟 手机平台USB3.0方案对比
MATLAB学习和实战 随手记
Contiki source code + principle + function + programming + transplantation + drive + network (turn)
5G工作原理详解(解释&图解)
map文件粗略分析
Raspberry pie tap switch button to use
open-mmlab labelImg mmdetection
Pytorch-温度预测