Skip to main content
Associate III
March 20, 2024
Solved

STM32CubeIDE 1.15.0: elf has a LOAD segment with RWX permissions

  • March 20, 2024
  • 20 replies
  • 74995 views

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

Best answer by JensH

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

20 replies

Associate II
March 20, 2024

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
March 20, 2024

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
March 20, 2024

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
March 20, 2024

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
March 20, 2024

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
March 21, 2024

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
March 21, 2024

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
March 24, 2024

Where is the "Miscellaneous" tab?

Thanks

Associate
March 22, 2024

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
March 23, 2024

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

PHolt.1
Senior
March 24, 2024

Where in the .ld file did you put it?

Visitor II
March 24, 2024

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
April 3, 2024

Only your advice helped, thank you!!!

PHolt.1
Senior
March 24, 2024

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
March 24, 2024

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
March 24, 2024

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
March 31, 2024

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

In the toolchain manager, I installed 11.3.rel1.