2024-08-05 12:37 AM
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://gcc.gnu.org/pipermail/gcc-patches/2005-January/160955.html
Thanks,
Paul
2024-08-13 07:35 AM
Hello @paulr227 ,
Try update and use the latest release of STM32CubeIDE.
This issue has been fixed and available in STM32CubeIDE 1.16.0:
2024-08-27 05:55 AM
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