diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2019-10-22 14:04:39 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-22 22:58:44 +0000 |
commit | f38ece9f9d731951a38c0bb88a1ec6578bfad30c (patch) | |
tree | 1ec6d7d75917c3c92d0a6529c2aeb03393fb7d93 | |
parent | e78c4c3c1e0839ba915e15ee2e711e4c0e5bb5d5 (diff) | |
download | chrome-ec-f38ece9f9d731951a38c0bb88a1ec6578bfad30c.tar.gz |
common: make __error discard symbols on clang
The clang compiler is used by the fuzz tests, and while clang does not
have support for the error attribute in GCC, we can do our best to
make sure that errors are raised on clang where appropriate by placing
functions defined with __error in the special section "/DISCARD/",
which the linker discards.
An error like below is shown when compiling in clang:
`foo' referenced in section `.text' of foo.o:
defined in discarded section `/DISCARD/' of /tmp/foo.o
BUG=none
BRANCH=none
TEST=see above error output when __error is used on clang
Change-Id: Id58131578f67b9dff7e58e5df58b3509d6046138
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1874382
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | include/common.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h index 2ed4e11b88..c1f9d6ffb5 100644 --- a/include/common.h +++ b/include/common.h @@ -344,7 +344,7 @@ enum ec_error_list { * errors. :( */ #ifdef __clang__ -#define __error(msg) +#define __error(msg) __attribute__((section("/DISCARD/"))) #else #define __error(msg) __attribute__((error(msg))) #endif |