Skip to content

Commit

Permalink
riscv: Suppress LOAD RWX linker warning
Browse files Browse the repository at this point in the history
Suppress the warning message "nuttx has a LOAD segment with RWX permissions" in case of RAM boot mode is selected.
RAM MODE: BOOT_RUNFROMEXTSRAM/BOOT_RUNFROMISRAM/BOOT_RUNFROMSDRAM/BOOT_COPYTORAM

Signed-off-by: Huang Qi <[email protected]>
  • Loading branch information
no1wudi authored and xiaoxiang781216 committed Nov 11, 2024
1 parent f94e092 commit 8a6e832
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/risc-v/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ if(CONFIG_RISCV_TOOLCHAIN STREQUAL GNU_RVG)
string(REGEX MATCH "([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
"${GCC_VERSION_OUTPUT}")
set(GCCVER ${CMAKE_MATCH_1})

if(GCCVER GREATER_EQUAL 12)
if(CONFIG_ARCH_RAMFUNCS OR NOT CONFIG_BOOT_RUNFROMFLASH)
add_link_options(-Wl,--no-warn-rwx-segments)
endif()
endif()
endif()

if(CONFIG_ARCH_RV_ISA_ZICSR_ZIFENCEI)
Expand Down
7 changes: 7 additions & 0 deletions arch/risc-v/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
ifeq ($(GCCVER),)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
endif
ifeq ($(shell expr "$(GCCVER)" \>= 12), 1)
ifeq ($(CONFIG_ARCH_RAMFUNCS),y)
LDFLAGS += --no-warn-rwx-segments
else ifeq ($(CONFIG_BOOT_RUNFROMFLASH),)
LDFLAGS += --no-warn-rwx-segments
endif
endif
endif
endif

Expand Down

0 comments on commit 8a6e832

Please sign in to comment.