diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-10-28 17:25:54 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-31 18:16:57 +0000 |
commit | e47af99c8948ed31d8149598564e9ade8d2e43eb (patch) | |
tree | 4728b467f17e392a9e3ccd7ddeeb94f58766e146 /zephyr/cmake | |
parent | 5d04062db5d836600b40dc54c339a1d43312ea89 (diff) | |
download | chrome-ec-e47af99c8948ed31d8149598564e9ade8d2e43eb.tar.gz |
zephyr: clang: Add -fstack-protector-all for tests
When running tests we can afford to look for stack smashing since we're
running in a test environment. This may prevent time-consuming debugging
in the future.
Add -fstack-protector-all to the clang compile options if CONFIG_ZTEST
is enabled.
BRANCH=none
BUG=none
TEST=Ran twister test and checked for option in ninja.build
TEST=Built herobrine and check for *no* option in ninja.build
TEST=./twister # Runs all tests
TEST=CQ
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Ib9ce15c18aae4bbc11f809a548e1afffcc650022
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3990554
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'zephyr/cmake')
-rw-r--r-- | zephyr/cmake/compiler/clang/compiler_flags.cmake | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/zephyr/cmake/compiler/clang/compiler_flags.cmake b/zephyr/cmake/compiler/clang/compiler_flags.cmake index 3423f1c36c..e1d91504ea 100644 --- a/zephyr/cmake/compiler/clang/compiler_flags.cmake +++ b/zephyr/cmake/compiler/clang/compiler_flags.cmake @@ -10,6 +10,9 @@ set_compiler_property(PROPERTY hosted) # Disable position independent code. add_compile_options(-fno-PIC) +# When testing, look for stack smashing +add_compile_option_ifdef(CONFIG_ZTEST -fstack-protector-all) + check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable -Werror=unused-variable -Werror=missing-braces -Werror=sometimes-uninitialized -Werror=unused-function |