This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 6373931cf1 nuttx/arch: Fix the issue where the compiler cannot
recognize min-pagesize=0.
6373931cf1 is described below
commit 6373931cf160a29a529774838f37b9e74c46f10c
Author: cuiziwei <[email protected]>
AuthorDate: Fri Oct 4 09:42:53 2024 +0800
nuttx/arch: Fix the issue where the compiler cannot recognize
min-pagesize=0.
Signed-off-by: cuiziwei <[email protected]>
---
arch/arm/src/common/Toolchain.defs | 18 ++++++++++++++----
arch/arm/src/tlsr82/Toolchain.defs | 4 ----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/arch/arm/src/common/Toolchain.defs
b/arch/arm/src/common/Toolchain.defs
index 355f7f598a..2232405686 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -305,10 +305,20 @@ else
endif
endif
- ARCHOPTIMIZATION += --param=min-pagesize=0
- ifeq ($(CONFIG_ARCH_RAMFUNCS),y)
- LDFLAGS += --no-warn-rwx-segments
- endif
+ # Workaround to skip -Warray-bounds check due to bug of GCC-12:
+ # Wrong warning array subscript [0] is outside array bounds:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
+
+ ifeq ($(GCCVER),)
+ export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.*
([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
+ endif
+
+ ifeq ($(GCCVER),12)
+ ARCHOPTIMIZATION += --param=min-pagesize=0
+ ifeq ($(CONFIG_ARCH_RAMFUNCS),y)
+ LDFLAGS += --no-warn-rwx-segments
+ endif
+ endif
LDFLAGS += --entry=__start
diff --git a/arch/arm/src/tlsr82/Toolchain.defs
b/arch/arm/src/tlsr82/Toolchain.defs
index 34bb0526b9..7e665770db 100644
--- a/arch/arm/src/tlsr82/Toolchain.defs
+++ b/arch/arm/src/tlsr82/Toolchain.defs
@@ -31,7 +31,3 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
endif
include $(TOPDIR)/arch/arm/src/common/Toolchain.defs
-
-# tlsr82 can not recognize --param=min-pagesize=0, so remove it from
ARCHOPTIMIZATION
-ARCHOPTIMIZATION := $(filter-out --param=min-pagesize=0,$(ARCHOPTIMIZATION))
-