summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-20 10:40:26 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-28 07:06:46 -0700
commitdcfbe0be69d3445edfd45fb036bfae2581b6fdd5 (patch)
treede448bc3d41945e0bc0cf2f098e10ca14fc49419 /include/common.h
parent6f38ed23f3d467937f15cf0474b8f323564bcc0d (diff)
downloadchrome-ec-dcfbe0be69d3445edfd45fb036bfae2581b6fdd5.tar.gz
ec: Make it possible to build tests using clang
We might want to try out address sanitizer/fuzzer on some host tests: make it possible to build host tests using clang. Board builds are broken, and there is no intention to fix them, at least for now. BRANCH=none BUG=chromium:854924 TEST=make buildall -j TEST=make CC=clang runtests -j Change-Id: Id49a1b8537bc403d53437a2245f4fab6ceae89ac Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107522 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h
index d465180c56..555f91a953 100644
--- a/include/common.h
+++ b/include/common.h
@@ -66,13 +66,24 @@
#endif
/*
+ * externally_visible is required by GCC to avoid kicking out memset.
+ */
+#ifndef __visible
+#ifndef __clang__
+#define __visible __attribute__((externally_visible))
+#else
+#define __visible __attribute__((used))
+#endif
+#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))
+#define __keep __attribute__((used)) __visible
#endif
/*