Skip to main content
Associate III
Mar 20, 2024 9:08 AM UTC
Solved

STM32CubeIDE 1.15.0: elf has a LOAD segment with RWX permissions

Hi @Imen.D  , @Khouloud ZEMMELI ,

After updating the STM32CubeIDE to version 1.15.0 (today) I am observing below warning.

The LD file has not changed. It has RAM and MRAM RWX

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

Memory sections in LD file:

MEMORY
{
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
MRAM (xrw) : ORIGIN = 0x60000000, LENGTH = 1024K
}

Please help resolve the concern.

Regards,

Rajeev

This topic has been closed for replies.
JensHBest answer
Associate II
Mar 20, 2024 12:06 PM UTC

Hi @RajeevAroraCrcEvans,

i have added an example.

You have copied every part, thats not correct.

Delete this part:

 .ARM.extab : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 Just use this:

.ARM.extab (READONLY) : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 And also at the other parts.

Best regards,

Jens

46 replies

Associate II
Mar 20, 2024 10:58 AM UTC

Hi Rajeev,

I had the same problem, this one is easy.

You have to edit your Linker-File. But you have to make sure that your configuration uses the correct file.

There must be an additional (READONLY) at these positions:

  • .ARM.extab (READONLY) :
  • .ARM (READONLY) :
  • .preinit_array (READONLY) :
  • .init_array (READONLY) :
  • .fini_array (READONLY) :

Best regards,

Jens

Associate III
Mar 20, 2024 11:20 AM UTC

Hi @JensH 

Are you informing that I need to update:

 

 .ARM.extab : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 

to

 

 .ARM.extab (READONLY) : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH
 .ARM.extab : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 

Is it possible for you to share a file with these settings?

Regards,

Rajeev

Associate II
Mar 20, 2024 11:56 AM UTC

Hi @RajeevAroraCrcEvans ,

no it's not that complicated.

Just add "(READONLY)". For example:

.ARM.extab (READONLY) :
 {
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 } >FLASH

.ARM (READONLY) :
 {
 __exidx_start = .;
 *(.ARM.exidx*)
 __exidx_end = .;
 } >FLASH

Best regards,

Jens

Associate III
Mar 20, 2024 12:00 PM UTC

Hi @JensH 

I still observe same error. That is why I requested for an example.

 /* Constant data goes into FLASH */
 .rodata :
 {
 . = ALIGN(4);
 *(.rodata) /* .rodata sections (constants, strings, etc.) */
 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
 . = ALIGN(4);
 } >FLASH

 .ARM.extab : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 .ARM.extab (READONLY) : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 .ARM : {
 . = ALIGN(4);
 __exidx_start = .;
 *(.ARM.exidx*)
 __exidx_end = .;
 . = ALIGN(4);
 } >FLASH

 .ARM (READONLY): {
 . = ALIGN(4);
 __exidx_start = .;
 *(.ARM.exidx*)
 __exidx_end = .;
 . = ALIGN(4);
 } >FLASH

 .preinit_array :
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__preinit_array_start = .);
 KEEP (*(.preinit_array*))
 PROVIDE_HIDDEN (__preinit_array_end = .);
 . = ALIGN(4);
 } >FLASH

 .preinit_array (READONLY):
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__preinit_array_start = .);
 KEEP (*(.preinit_array*))
 PROVIDE_HIDDEN (__preinit_array_end = .);
 . = ALIGN(4);
 } >FLASH

 .init_array :
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__init_array_start = .);
 KEEP (*(SORT(.init_array.*)))
 KEEP (*(.init_array*))
 PROVIDE_HIDDEN (__init_array_end = .);
 . = ALIGN(4);
 } >FLASH

 .init_array (READONLY):
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__init_array_start = .);
 KEEP (*(SORT(.init_array.*)))
 KEEP (*(.init_array*))
 PROVIDE_HIDDEN (__init_array_end = .);
 . = ALIGN(4);
 } >FLASH

 .fini_array :
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__fini_array_start = .);
 KEEP (*(SORT(.fini_array.*)))
 KEEP (*(.fini_array*))
 PROVIDE_HIDDEN (__fini_array_end = .);
 . = ALIGN(4);
 } >FLASH

 .fini_array (READONLY):
 {
 . = ALIGN(4);
 PROVIDE_HIDDEN (__fini_array_start = .);
 KEEP (*(SORT(.fini_array.*)))
 KEEP (*(.fini_array*))
 PROVIDE_HIDDEN (__fini_array_end = .);
 . = ALIGN(4);
 } >FLASH
JensHBest answer
Associate II
Mar 20, 2024 12:06 PM UTC

Hi @RajeevAroraCrcEvans,

i have added an example.

You have copied every part, thats not correct.

Delete this part:

 .ARM.extab : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 Just use this:

.ARM.extab (READONLY) : {
 . = ALIGN(4);
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 . = ALIGN(4);
 } >FLASH

 And also at the other parts.

Best regards,

Jens

PHolt.1
Senior
Mar 21, 2024 2:15 PM UTC

I get this too. This is complicated. But v15 is brain-dead anyway, so I reverted to 1.14.1 and everything is perfect. :beaming_face_with_smiling_eyes:

PHolt.1
Senior
Mar 21, 2024 6:09 PM UTC

To remove that warning just add "--no-warn-rwx-segments" and "--no-warn-execstack" to the linker flags under "Miscellaneous" tab.

Source: https://lore.kernel.org/all/20220802083023.1488625-1-joel@jms.id.au/T/

(from eevblog)

SBenn.2
Associate
Mar 24, 2024 11:41 AM UTC

Where is the "Miscellaneous" tab?

Thanks

Associate
Mar 22, 2024 2:54 AM UTC

This is complete hell.

Where exactly is this file?   Is there one for ever single MCU I use?

Who in the hell came up with this idea?

Visitor II
Mar 23, 2024 5:47 PM UTC

In my case also helped adding (READONLY) in STM32C011F6PX_FLASH.ld

PHolt.1
Senior
Mar 24, 2024 7:52 AM UTC

Where in the .ld file did you put it?

Visitor II
Mar 24, 2024 11:16 AM UTC

in 5 places:

 

.ARM.extab (READONLY) : {

. = ALIGN(4);

*(.ARM.extab* .gnu.linkonce.armextab.*)

. = ALIGN(4);

} >FLASH

 

.ARM (READONLY) : {

. = ALIGN(4);

__exidx_start = .;

*(.ARM.exidx*)

__exidx_end = .;

. = ALIGN(4);

} >FLASH

 

.preinit_array (READONLY) :

{

. = ALIGN(4);

PROVIDE_HIDDEN (__preinit_array_start = .);

KEEP (*(.preinit_array*))

PROVIDE_HIDDEN (__preinit_array_end = .);

. = ALIGN(4);

} >FLASH

 

.init_array (READONLY):

{

. = ALIGN(4);

PROVIDE_HIDDEN (__init_array_start = .);

KEEP (*(SORT(.init_array.*)))

KEEP (*(.init_array*))

PROVIDE_HIDDEN (__init_array_end = .);

. = ALIGN(4);

} >FLASH

 

.fini_array (READONLY):

{

. = ALIGN(4);

PROVIDE_HIDDEN (__fini_array_start = .);

KEEP (*(SORT(.fini_array.*)))

KEEP (*(.fini_array*))

PROVIDE_HIDDEN (__fini_array_end = .);

. = ALIGN(4);

} >FLASH

 

SGran.5
Associate
Apr 3, 2024 2:35 PM UTC

Only your advice helped, thank you!!!

PHolt.1
Senior
Mar 24, 2024 1:44 PM UTC

Of the five places listed above I have only the last three in my LinkerScript.ld file.

But I have uninstalled Cube v15 and put it 14.1 because v15 fails to work with the debugger so is completely useless. I might try it again sometime, or just document the project as needing v14.1 (i.e. GCC tools pre-v12).

There is actually no point in constantly upgrading Cube and chasing the latest version of GCC tools. It just creates unnecessary work and if you think about it you will come to a point where you have to do that otherwise you have to allocate endless effort to a given project for ever.

SBenn.2
Associate
Mar 24, 2024 2:45 PM UTC

Could the problem be some other part of your system, I have no problem connecting the debugger to the target and single stepping and running to breakpoints?

PHolt.1
Senior
Mar 24, 2024 3:18 PM UTC

Multiple threads running on Cube 1.15.0 problems and I think I saw one from somebody at ST saying they agree with that "missing file" error.

Visitor II
Mar 31, 2024 9:33 AM UTC

I change gcc toolchain from 12.3.rel1 to 11.3.rel1, that warning disappeared.

In the toolchain manager, I installed 11.3.rel1.