From dcfbe0be69d3445edfd45fb036bfae2581b6fdd5 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 20 Jun 2018 10:40:26 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1107522 Reviewed-by: Vincent Palatin --- include/common.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include/common.h') diff --git a/include/common.h b/include/common.h index d465180c56..555f91a953 100644 --- a/include/common.h +++ b/include/common.h @@ -65,6 +65,17 @@ #define __unused __attribute__((unused)) #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. @@ -72,7 +83,7 @@ * 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 /* -- cgit v1.2.1