diff --git a/board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch b/board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch new file mode 100644 index 0000000000..7a7a7bbc28 --- /dev/null +++ b/board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch @@ -0,0 +1,51 @@ +From b2a94de52ae4a940a87d569815b19d3fa92dd32a Mon Sep 17 00:00:00 2001 +From: Tom Hochstein +Date: Mon, 16 May 2022 13:45:16 -0500 +Subject: [PATCH] LF-7968-01 fix(Makefile): Suppress array-bounds error + +The array-bounds error is triggered now in cases where it was silent +before, causing errors like: + +``` +plat/imx/imx8m/hab.c: In function 'imx_hab_handler': +plat/imx/imx8m/hab.c:64:57: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds] + 64 | #define HAB_RVT_CHECK_TARGET_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x18)) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` + +The error is a false-positive and is entered as a bug [1]. The problem +is fixed partially in GCC 12 and fully in GCC 13 [2]. + +The partial fix does not work here because the constant addresses used +are less than the 4kB boundary chosen for the partial fix, so suppress +the error until GCC is upgraded to 13. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 +[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c39 + +Upstream-Status: Inappropriate [other] +Signed-off-by: Tom Hochstein +Signed-off-by: Jacky Bai +Reviewed-by: Ye Li +Signed-off-by: Brandon Maier +Upstream: https://github.com/nxp-imx/imx-atf/commit/058bf0f104115037d03e277f079825ef3659c5b9 +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index c87c3ae08..2d6b90f47 100644 +--- a/Makefile ++++ b/Makefile +@@ -346,7 +346,7 @@ WARNINGS += -Wshift-overflow -Wshift-sign-overflow \ + endif + + ifneq (${E},0) +-ERRORS := -Werror ++ERRORS := -Werror -Wno-error=array-bounds + endif + + CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ +-- +2.41.0 +