cmake: Set GCC min-pagesize parameter to 0

GCC 11 and above may generate a warning when dereferencing a constant
address pointer whose address is below the value specified by the
`min-pagesize` parameter.

This commit sets the `min-pagesize` parameter to 0 such that GCC never
generates the warnings for any constant address pointers.

For more details, refer to the GCC PR99578.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2022-08-15 22:44:06 +09:00 committed by Carles Cufí
parent ca4c2c9b7f
commit 5af932f6e7

View file

@ -383,6 +383,13 @@ if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
# GCC assumed
zephyr_cc_option(-fno-reorder-functions)
# GCC 11 and above may generate a warning when dereferencing a constant
# address pointer whose address is below the value specified by the
# `min-pagesize` parameter (defaults to 0x1000). The `min-pagesize` parameter
# is set to 0 such that GCC never generates any warnings for the constant
# address pointers. For more details, refer to the GCC PR99578.
zephyr_cc_option(--param=min-pagesize=0)
if(NOT ${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "xcc")
zephyr_cc_option(-fno-defer-pop)
endif()