Skip to content

Fix LOAD Segment With RWX Permissions Warning#365

Open
r2axz wants to merge 2 commits intoObKo:masterfrom
r2axz:master
Open

Fix LOAD Segment With RWX Permissions Warning#365
r2axz wants to merge 2 commits intoObKo:masterfrom
r2axz:master

Conversation

@r2axz
Copy link
Contributor

@r2axz r2axz commented Jan 31, 2026

Starting with GCC11 LD shows the following error message when using the autogenerated linker script:

arm-none-eabi/bin/ld: warning: testi.elf has a LOAD segment with RWX permissions

This happens because some sections that go into the FLASH memory have read-write access permissions which in turn forces FLASH to become RWX.

Here is a relevant StackOverflow thread: https://stackoverflow.com/questions/73429929/gnu-linker-elf-has-a-load-segment-with-rwx-permissions-embedded-arm-project

ST suggest to change sections like

.preinit_array :
 {
   …
 } >FLASH

to

 .preinit_array (READONLY) :
 {
   …
 } >FLASH

Reference: https://wiki.st.com/stm32mcu/wiki/STM32CubeIDE:STM32CubeIDE_errata_1.15.x#General_issues
See 169316

This pull request adds the (READONLY) attribute to the corresponding sections if GCC version >= 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant