diff options
author | Craig Hesling <hesling@chromium.org> | 2019-07-29 11:12:49 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-30 23:58:20 +0000 |
commit | d754f92d3beb9b1d7d19ec081c39dd87b964473f (patch) | |
tree | 42624cf2e36022e2e0b3bca75d69c0a648ae9493 /include/trng.h | |
parent | aed16e293cb4bd17b301ac9f1508402bcb233bb1 (diff) | |
download | chrome-ec-d754f92d3beb9b1d7d19ec081c39dd87b964473f.tar.gz |
util: Move __stdlib_compat to function definitions
Putting a visibility-hidden attribute in the header file
is ambiguous. The compiler cannot determine which definition
should be hidden (our implementation or stdlib).
This serves as a slight correction to the work in crrev.com/c/1180401 .
In particular, this fixes test/fuzz builds with code coverage enabled:
make runtests TEST_COVERAGE=1 -j
Before this fix, enabling coverage would trigger build errors,
like the following:
In file included from common/test_util.c:19:
include/util.h:82:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
__stdlib_compat int atoi(const char *nptr);
^
include/common.h:267:40: note: expanded from macro '__stdlib_compat'
#define __stdlib_compat __attribute__((visibility("hidden")))
^
/usr/include/stdlib.h:361:8: note: previous definition is here
__NTH (atoi (const char *__nptr))
Note that enabling sanitizer on some unit tests is still broken
(as it was before this CL). For example, these unit tests fail
when compiling with sanitizers:
make host-charge_manager_drp_charging TEST_ASAN=1
make host-charge_manager_drp_charging TEST_MSAN=1
BRANCH=none
BUG=none
TEST=make runtests TEST_COVERAGE=1 -j
TEST=make buildall -j
Change-Id: I74462c964c0ff9d3ee131450e6826cbbd6c89319
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1724936
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/trng.h')
-rw-r--r-- | include/trng.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/trng.h b/include/trng.h index e50b12a2a6..cea4555b41 100644 --- a/include/trng.h +++ b/include/trng.h @@ -32,7 +32,7 @@ void exit_trng(void); * Not supported on all platforms. **/ #ifndef HIDE_EC_STDLIB -__stdlib_compat uint32_t rand(void); +uint32_t rand(void); #endif /** |