From 6a9a3a62732ff31e247a9eb61a5f4e7c53154ee5 Mon Sep 17 00:00:00 2001 From: Allen Webb Date: Fri, 17 Aug 2018 14:56:33 -0700 Subject: fuzz: Hide conflicts with cstdlib and use clang++ for linking. This creates a build target called libec.a by setting the visibility of functions that conflict with cstdlib to hidden. It then links those symbols locally into one large object file that makes up libec.a Fuzzing targets are linked against libec.a so that they can invoke ec functionality while depending on outside libraries that need cstdlib. When linking a particular object against cstdlib, to avoid conflicting function declarations put the following before any includes from the ec codebase: #define __stdlib_compat(...) The fuzzing targets are now linked using clang++, so that c++ libraries and objects can be used as part of the fuzzers. BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztests && ./build/host/host_command_fuzz/host_command_fuzz.exe Change-Id: Ifdfdc6a51c6ef23b4e192b013ca993bf48a4411b Signed-off-by: Allen Webb Reviewed-on: https://chromium-review.googlesource.com/1180401 Reviewed-by: Randall Spangler --- builtin/assert.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin') diff --git a/builtin/assert.h b/builtin/assert.h index 1a4c64eb68..6ee2ac1b20 100644 --- a/builtin/assert.h +++ b/builtin/assert.h @@ -41,6 +41,9 @@ extern void panic_assert_fail(const char *msg, const char *func, #define ASSERT(cond) #endif +/* This collides with cstdlib, so exclude it where cstdlib is supported. */ +#ifndef assert #define assert(x...) ASSERT(x) +#endif #endif /* __CROS_EC_ASSERT_H__ */ -- cgit v1.2.1