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 /include/common.h | |
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 'include/common.h')
-rw-r--r-- | include/common.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 59e66b7f29..af451a3ec9 100644 --- a/include/common.h +++ b/include/common.h @@ -58,6 +58,16 @@ #define __packed __attribute__((packed)) #endif +/* + * Force the toolchain to keep a symbol even with Link Time Optimization + * activated. + * + * Useful for C functions called only from assembly or through special sections. + */ +#ifndef __keep +#define __keep __attribute__((used)) __attribute__((externally_visible)) +#endif + /* There isn't really a better place for this */ #define C_TO_K(temp_c) ((temp_c) + 273) #define K_TO_C(temp_c) ((temp_c) - 273) |