summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBoyan Karatotev <boyan.karatotev@arm.com>2023-04-17 12:42:20 +0100
committerBoyan Karatotev <boyan.karatotev@arm.com>2025-11-26 17:42:36 +0000
commitfa28b3afd3dc12d3eff922f61520dd0bab52755e (patch)
treec5432c7e52a1e4784baf3aeb2c75c7c0433b1718 /Makefile
parent1d5aa939bc8d3d892e2ed9945fa50e36a1a924cc (diff)
downloadarm-trusted-firmware-fa28b3afd3dc12d3eff922f61520dd0bab52755e.tar.gz
arm-trusted-firmware-fa28b3afd3dc12d3eff922f61520dd0bab52755e.zip
feat(build): enable link-time optimization by default
Enable LTO by default for all platforms and compilers. LTO performs optimisation at link-time rather than at compilation time, and allows optimisations to be made across compilation unit boundaries (i.e. C files). This is especially useful in areas with lots of closely related compilation units that operate on the same data structures (eg PSCI and context management). The only drawback is that LTO makes conditions ripe for the build to heavily mangle all functions, making debugging a nightmare. So only enable for release builds. Note this will make object files unintepretable by objdump. Use lto-dump instead. BREAKING-CHANGE: LTO has been enabled by default, which may cause unpredictable issues for platforms where the linker scripts have not been designed with LTO in mind. Please report any issues to the [mailing list](mailto:tf-a@lists.trustedfirmware.org). Change-Id: Ia472aff1a23366d918abded7a1c5da695f2c4787 Co-authored-by: Chris Kay <chris.kay@arm.com> Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c96fcd2fc..c7a39ac65 100644
--- a/Makefile
+++ b/Makefile
@@ -141,6 +141,12 @@ else
BUILD_TYPE := release
# Use LOG_LEVEL_NOTICE by default for release builds
LOG_LEVEL := 20
+ # Enable link-time optimization (AKA "inter-procedural optimization")
+ ifeq (${ARCH},aarch64)
+ ifeq ($($(ARCH)-ld-id),$($(ARCH)-cc-id))
+ ENABLE_LTO := 1
+ endif
+ endif
endif #(Debug)
# Default build string (git branch and commit)