diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-04-27 14:47:19 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-19 02:46:27 +0000 |
commit | 2650ff3d70c9933e4c3dcd1401ca66b4426def4a (patch) | |
tree | 7a4658b060d3439a525a7562c226358d55424035 /common | |
parent | cb29daa58c0fa5866a7847c454967ef0376c7688 (diff) | |
download | chrome-ec-2650ff3d70c9933e4c3dcd1401ca66b4426def4a.tar.gz |
Add option to enable GCC LTO
Add CONFIG_LTO to use GCC Link-Time Optimizations to try to reduce the
flash footprint of the firmware.
Add additional protection to some functions/data to avoid removal by the
linker when their usage is not obvious.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=make buildall (with and without LTO enable on all boards)
Change-Id: I586b8c1eda4592b416c85383b65153c1d5ab0059
Reviewed-on: https://chromium-review.googlesource.com/271291
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/clz.c | 4 | ||||
-rw-r--r-- | common/main.c | 2 | ||||
-rw-r--r-- | common/version.c | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/common/clz.c b/common/clz.c index 30c987e367..456683b0cd 100644 --- a/common/clz.c +++ b/common/clz.c @@ -5,6 +5,8 @@ * Software emulation for CLZ instruction */ +#include "common.h" + /** * Count leading zeros * @@ -12,7 +14,7 @@ * @return the number of leading 0-bits in x, * starting at the most significant bit position. */ -int __clzsi2(int x) +int __keep __clzsi2(int x) { int r = 0; diff --git a/common/main.c b/common/main.c index f30f2970cd..a2f86abdee 100644 --- a/common/main.c +++ b/common/main.c @@ -33,7 +33,7 @@ #define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) -test_mockable int main(void) +test_mockable __keep int main(void) { /* * Pre-initialization (pre-verified boot) stage. Initialization at diff --git a/common/version.c b/common/version.c index b6cc8e1d8b..331f155571 100644 --- a/common/version.c +++ b/common/version.c @@ -11,14 +11,14 @@ #include "ec_version.h" #include "version.h" -const struct version_struct version_data +const struct version_struct __keep version_data __attribute__((section(".rodata.ver"))) = { CROS_EC_VERSION_COOKIE1, CROS_EC_VERSION32, CROS_EC_VERSION_COOKIE2 }; -const char build_info[] __attribute__((section(".rodata.buildinfo"))) = +const char build_info[] __keep __attribute__((section(".rodata.buildinfo"))) = CROS_EC_VERSION " " DATE " " BUILDER; uint32_t ver_get_numcommits(void) |