summaryrefslogtreecommitdiff
path: root/include/extension.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-21 08:39:30 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-28 07:06:46 -0700
commit6c6888037c8d82228b480eeba0eaf1b0aa83e9f8 (patch)
tree5ccd44915959fa98d811bb4e53f71b295ec41317 /include/extension.h
parentdcfbe0be69d3445edfd45fb036bfae2581b6fdd5 (diff)
downloadchrome-ec-6c6888037c8d82228b480eeba0eaf1b0aa83e9f8.tar.gz
ec: Make it possible to run tests with AddressSanitizer enabled
Automatically use CC=clang if TEST_ASAN is specified. Also, add a __no_sanitize_address attribute macro to prevent ASan from adding guards around host_command, mkbp_event, and hook "arrays" that are generated at link-time. Also, set ASAN_OPTIONS env variable in run_host_test. BRANCH=none BUG=chromium:854924 TEST=make TEST_ASAN=y runtests -j Change-Id: Iaf0ec405022760d757a8a9d62a5022460d1b16e1 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1109661 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/extension.h')
-rw-r--r--include/extension.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/extension.h b/include/extension.h
index ed7dd70f32..b984c583b0 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -74,7 +74,8 @@ struct extension_command {
&params->out_size); \
return VENDOR_RC_SUCCESS; \
} \
- const struct extension_command __keep __extension_cmd_##code \
+ const struct extension_command __keep __no_sanitize_address \
+ __extension_cmd_##code \
__attribute__((section(".rodata.extensioncmds"))) \
= {.command_code = code, .handler = func##_wrap }
@@ -86,13 +87,15 @@ struct extension_command {
return func(params->code, params->buffer, \
params->in_size, &params->out_size); \
} \
- const struct extension_command __keep __vendor_cmd_##cmd_code \
+ const struct extension_command __keep __no_sanitize_address \
+ __vendor_cmd_##cmd_code \
__attribute__((section(".rodata.extensioncmds"))) \
= {.command_code = cmd_code, .handler = func##_wrap}
/* Vendor command which takes params as struct */
#define DECLARE_VENDOR_COMMAND_P(cmd_code, func) \
- const struct extension_command __keep __vendor_cmd_##cmd_code \
+ const struct extension_command __keep __no_sanitize_address \
+ __vendor_cmd_##cmd_code \
__attribute__((section(".rodata.extensioncmds"))) \
= {.command_code = cmd_code, .handler = func}