# 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: | 11 Sep 2026 |

| Author: | Victor Do Nascimento |
|---------|----------------------|
| 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), [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?

Upon completion of this Learning Path, you will be able to:

- 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 will need the following:

- An Arm Linux system (cloud instance, on-premises hardware, or a virtual machine)
- 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

<details>
<summary>Do I need to pass -flto at both compile and link time?</summary>
Yes. Compile each translation unit with `-flto` and also pass `-flto` to the final link so that GCC performs whole‑program optimization.
</details>

<details>
<summary>How do I build a small program with LTO in one command?</summary>
Use a single `gcc` invocation that includes your optimization level and `-flto`. This compiles and links with LTO enabled in one step.
</details>

<details>
<summary>What should I expect from the linker when LTO is enabled?</summary>
Object files contain LTO information in special sections. The final link performs whole‑program optimization before generating machine code.
</details>

<details>
<summary>How do I know LTO was applied to my build?</summary>
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.
</details>

<details>
<summary>How should I evaluate the impact of LTO on my application?</summary>
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.
</details>
