diff options
author | Chris Kay <chris.kay@arm.com> | 2018-09-27 13:16:54 +0100 |
---|---|---|
committer | ronald-cron-arm <39518861+ronald-cron-arm@users.noreply.github.com> | 2018-10-08 17:49:02 +0200 |
commit | 85a3ddc59b591a60b23cea544fb78ff3c024f706 (patch) | |
tree | 8efd9ae6516306fcb100c943d8bd48ecddb9d9c8 /tools/build_system | |
parent | ec897cb4575765490da530b5362cc6bade3f215f (diff) |
arm: Enable garbage collection of unused functions/data
This patch adds flags enabling the linker to remove functions and data
that are not referenced, substantially reducing the size of the final
binary.
Change-Id: I4b276eb27fed776de78f2dd22c9658609643cb6b
Signed-off-by: Chris Kay <chris.kay@arm.com>
Diffstat (limited to 'tools/build_system')
-rw-r--r-- | tools/build_system/rules.mk | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/build_system/rules.mk b/tools/build_system/rules.mk index 1763bb13..6fb61d9c 100644 --- a/tools/build_system/rules.mk +++ b/tools/build_system/rules.mk @@ -97,6 +97,12 @@ CFLAGS_GCC += -Wno-missing-field-initializers # warn about the situations that have not already been fixed. CFLAGS_CLANG += -Wno-missing-braces +# Place functions and data into their own sections. This allows the linker to +# strip out functions with no references. +CFLAGS_GCC += -ffunction-sections -fdata-sections +LDFLAGS_GCC += -Wl,--gc-sections +LDFLAGS_ARM += -Wl,--remove + # Arm Compiler 6 uses dollar symbols in its linker-defined symbol names CFLAGS_CLANG += -Wno-dollar-in-identifier-extension |