summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2021-09-24 13:52:05 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-24 22:56:09 +0000
commitc07531e0ae87765121ef70979fa8f8e8cb27d0a9 (patch)
tree11406df5635d56f36eaf3f4414e1751358dfb85c
parentc5cf86f5d972f281ab7bec62a6463aa6506d5c1a (diff)
downloadchrome-ec-c07531e0ae87765121ef70979fa8f8e8cb27d0a9.tar.gz
cr50: add support for upcoming update to gcc 11.2 in coreboot-sdk
Coreboot-sdk is going to be updated to gcc 11.2 soon. Preliminary tests show that cr50 can successfully be compiled with it, however default warnings seems produce to many false positive errors. Disable string-overflow to make code compile. I tried to fix it, but found nothing to fix. Example in dcrypto_bn.c:1323 it complains: if (!rand64(ctx->rnd) board/cr50/dcrypto/dcrypto_bn.c: In function 'dcrypto_modexp_blinded': board/cr50/dcrypto/dcrypto_bn.c:1323:14: warning: 'rand64' accessing 8 bytes in a region of size 0 [-Wstringop-overflow=] 1323 | if (!rand64(ctx->rnd)) | ^ board/cr50/dcrypto/dcrypto_bn.c:1323:14: note: referencing argument 1 of type 'uint32_t *' board/cr50/dcrypto/dcrypto_bn.c:1160:13: note: in a call to function 'rand64' 1160 | static bool rand64(uint32_t dst[2]) | ^ board/cr50/tpm2/ecc.c: In function '_cpri__EccPointMultiply': board/cr50/tpm2/ecc.c:81:25: warning: 'p256_to_bin' accessing 32 bytes in a region of size 1 [-Wstringop-overflow=] 81 | p256_to_bin(&out_x, out->x.b.buffer); | ^ board/cr50/tpm2/ecc.c:81:25: note: referencing argument 2 of type 'uint8_t *' board/cr50/dcrypto/p256.c:119:6: note: in a call to function 'p256_to_bin' 119 | void p256_to_bin(const p256_int *src, uint8_t dst[P256_NBYTES]) Common pattern is when function prototype defines pointer as an array of specified type. Interestingly, that in case of ctx->rnd, rnd is uint32_t rnd[2], so complain is unnecessary. In case of ecc it's hard to explain that there is enough space. BUG=None TEST=make buildall -j Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I6bc071e4b536095535b9766d14600f5cb491f118 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3183334 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--core/cortex-m/build.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk
index 2bcf32317d..049eb49859 100644
--- a/core/cortex-m/build.mk
+++ b/core/cortex-m/build.mk
@@ -16,7 +16,7 @@ CFLAGS_FPU-$(CONFIG_FPU)=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
# CPU specific compilation flags
CFLAGS_CPU+=-mthumb -Os -mno-sched-prolog
-CFLAGS_CPU+=-mno-unaligned-access
+CFLAGS_CPU+=-mno-unaligned-access -Wno-stringop-overflow
CFLAGS_CPU+=$(CFLAGS_FPU-y)
ifneq ($(CONFIG_LTO),)