cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CuebIDE Issue 169316: “elf has a LOAD segment with RWX permissions”

paulr227
Associate

Hello,

The errata for STM32CubeIDE v1.15 lists the known issue, 169316 "elf has a LOAD segment with RWX permissions", however while v1.16 still lists this as a known issue, it also lists it under "Fixed Issues". Could you kindly confirm the current state of this issue, and if it is actually fixed, what the fix is?

As far I can tell the warning is still generated in my v1.16 installation (GNU Tools for STM32 12.3, gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623). As the "workaround" is not backward compatible with the GNU tools earlier than version 10, and such conditionals can't be checked within the linker script itself, this is rather ugly when also having to support new and old toolchains, especially as the warning itself doesn't necessarily seem particularly applicable to embedded microcontroller executables.

As far as I understand, the ELF sections SHT_INIT_ARRAY, SHT_PREINIT_ARRAY and SHT_FINI_ARRAY are defined to have SHF_ALLOC+SHF_WRITE attributes, so I understand why GCC emits these attributes. However, is SHF_WRITE really valid for arm-none-eabi targets where these tables are typically placed in Flash without the need to be relocated during any dynamic loading?

It does appear there has been a precedent for not setting the SHF_WRITE attribute for these input sections in the past, could something similar be considered here for bare metal targets?

https://github.com/ARM-software/rasc-devkit/blob/7358ff715b454158b78c033eceb95054136e1c29/binutils/bfd/elf32-arm.c#L10336

https://gcc.gnu.org/pipermail/gcc-patches/2005-January/160955.html

Thanks,

Paul

2 REPLIES 2
Imen.D
ST Employee

Hello @paulr227 ,

Try update and use the latest release of STM32CubeIDE.

This issue has been fixed and available in STM32CubeIDE 1.16.0:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
paulr227
Associate

Hello Imen,

Thanks for the response. Looks like it's still a problem:

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: <...>.elf has a LOAD segment with RWX permissions

I have not added "READONLY" to section selector as this would appear to be a workaround rather than a solution and I'm trying to confirm if there is an actual solution. Is this what the solution is considered to be? This is not backward compatible with earlier versions of the toolchain.

The sections I am receiving a warning for are the init array, pre-init array, and fini array. Why do these need to be marked with the SHF_WRITE attribute in embedded systems where dynamic loading is not being used and therefore no dynamic relocation required?

Thanks,

Paul