# Optimize performance using Link-Time Optimization with GCC

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/gcc-lto/)
- [An LTO Primer](https://learn.arm.com/learning-paths/servers-and-cloud-computing/gcc-lto/background/)
- [Deploying LTO](https://learn.arm.com/learning-paths/servers-and-cloud-computing/gcc-lto/request-lto/)
- [Potential Gains](https://learn.arm.com/learning-paths/servers-and-cloud-computing/gcc-lto/performance-uplift/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/gcc-lto/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Introductory |
| Reading time: | 15 min |
| Last updated: | 08 Oct 2026 |

|  |  |
| --- | --- |
| Author: | Victor Do Nascimento , Arm |
| Arm IP: | [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture) [Arm AGI CPU](https://learn.arm.com/tag/arm-agi-cpu) [Linux](https://learn.arm.com/tag/linux) [GCC](https://learn.arm.com/tag/gcc) |

### Who is this for?
This is an introductory topic for developers who want to improve application performance using link-time optimization (LTO) with the GCC toolchain.

### What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Understand how LTO works and when to apply it.
- Enable and configure LTO with GCC compiler flags.
- Evaluate the performance and code size trade-offs of LTO.

### Prerequisites
Before starting, you'll need the following prerequisites:
- An Arm-based Linux system (cloud-hosted, virtualized, or on-premise), including Arm AGI CPU-based systems.
- A recent version of the [GCC toolchain](https://learn.arm.com/install-guides/gcc/).

### Summary
You’ll explore LTO with GCC on Arm Linux systems. First, you’ll enable LTO with the `-flto` flag during compilation and linking, then inspect how GCC performs whole-program optimization. You’ll compare runtime and binary size before and after LTO, using SPEC CPU2017 integer rate as a reference.

### Frequently asked questions

**Do I need to pass -flto at both compile and link time?**

Yes. Compile each translation unit with `-flto` and also pass `-flto` to the final link so that GCC performs whole‑program optimization.

**How do I build a small program with LTO in one command?**

Use a single `gcc` invocation that includes your optimization level and `-flto`. This compiles and links with LTO enabled in one step.

**What should I expect from the linker when LTO is enabled?**

Object files contain LTO information in special sections. The final link performs whole‑program optimization before generating machine code.

**How do I know LTO was applied to my build?**

Confirm that all compile steps and the final link included `-flto`. If `-flto` is missing from any step, the link won’t perform whole‑program optimization.

**How should I evaluate the impact of LTO on my application?**

Compare runtime and binary size before and after enabling `-flto`. Refer to the SPEC CPU2017 integer rate as an example framework to understand potential performance changes.
