A Few Effective gcc/clang Optimizations for Embedded Systems
summary
Practical, measurable gcc/clang tactics to shrink and speed embedded Linux binaries: generate and inspect linker map files and binaries with objdump, size, nm, strip, prefer -O2, -Os, -Og based on a measured baseline, enable stack-protector/fortify for security-aware tradeoffs, use profile-guided optimization, favor fixed-width types like uint32_t/uintptr_t to match the CPU word size, avoid globals in hot loops, mark immutable data const, use attributes/pragmas to aid vectorization, exploit tail-call elimination and inline heuristics, and treat inline asm as a portability last resort.
AI-written summary · about
chapters (22)
- 0:00Introduction
- 0:55Agenda
- 2:03Tools Know Your Compiler
- 3:22Memory Layout
- 5:04Map Files
- 8:24Optimization Levels
- 11:49Meta Optimization Options
- 12:25Stack Protector Options
- 14:27Compiler Support
- 15:16Processor World Size
- 16:57Type Systems
- 18:17Const
- 19:57Function Parameters
- 24:06Loops
- 26:11Attributes
- 28:02Baselines
- 30:10Portability
- 32:20ternary operator
- 33:23stack size
- 35:16ncall optimization
- 37:19recursion optimization
- 38:10summary
related talks
54mGCC/Clang Optimizations for Embedded Linux
34mCode Size Compiler Optimizations and Techniques for Embedded Systems
28mCode optimization tips and tricks
19mExploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the(…)
15mNot So Fast: Understanding and Mitigating Negative Impacts of Compiler Optimizations on Code Reuse G
52mUnderstanding Compiler Optimization
24m(Ab)using Compiler Tools
19mGCC Compiler Code Size Density
