summaryrefslogtreecommitdiff
path: root/include/link_defs.h
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-12-12 19:14:39 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-23 14:46:08 -0800
commit216ab1e1d8d74bc722d3e322b2460802e93a5df9 (patch)
tree558d24d9021ff2a27af623065e55cd91fa8b67ac /include/link_defs.h
parent4c98d54c19702fdad5864ae6518913a21b64b192 (diff)
downloadchrome-ec-216ab1e1d8d74bc722d3e322b2460802e93a5df9.tar.gz
core/cortex-m: Support prevent chip memory region from GC.
We would like to keep a symbol in a chip memory region from GC in link time. However __attribute__((used)) cannot fulfill the requirement in such situation. This CL adds a "name.keep" section to prevent all the symbols in this section in a chip memory region from GC. Also, we would like to support a non-NOLOAD section, which can load default value on runtime. BUG=b:120825336 TEST=make buildall -j BRANCH=none Change-Id: I76cf445f6b4c0b61c20182a1aaf5a44f962049ae Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1373949 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/link_defs.h')
-rw-r--r--include/link_defs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/link_defs.h b/include/link_defs.h
index 61648baa0f..299cf54b75 100644
--- a/include/link_defs.h
+++ b/include/link_defs.h
@@ -111,8 +111,11 @@ extern const void *__data_end;
/* Helper for special chip-specific memory sections */
#ifdef CONFIG_CHIP_MEMORY_REGIONS
#define __SECTION(name) __attribute__((section("." STRINGIFY(name) ".50_auto")))
+#define __SECTION_KEEP(name) \
+ __attribute__((section("." STRINGIFY(name) ".keep.50_auto")))
#else
#define __SECTION(name)
+#define __SECTION_KEEP(name)
#endif /* CONFIG_MEMORY_REGIONS */
#ifdef CONFIG_CHIP_UNCACHED_REGION
#define __uncached __SECTION(CONFIG_CHIP_UNCACHED_REGION)