Skip to content

Commit

Permalink
rp2040_link: Explicitly set klipper.elf output section flags to avoid…
Browse files Browse the repository at this point in the history
… warning

Avoid pointless "LOAD segment with RWX permissions" linker warnings
during the rp2040 build.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
  • Loading branch information
KevinOConnor authored and rogerlz committed Jul 4, 2024
1 parent 4f0e972 commit fddf8e9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/rp2040/rp2040_link.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ MEMORY
ram (rwx) : ORIGIN = CONFIG_RAM_START , LENGTH = CONFIG_RAM_SIZE
}

// Force flags for each output section to avoid RWX linker warning
PHDRS
{
text_segment PT_LOAD FLAGS(5); // RX flags
ram_vectortable_segment PT_LOAD FLAGS(6); // RW flags
data_segment PT_LOAD FLAGS(6); // RW flags
bss_segment PT_LOAD FLAGS(6); // RW flags
stack_segment PT_LOAD FLAGS(6); // RW flags
}

SECTIONS
{
.text : {
Expand All @@ -32,7 +42,7 @@ SECTIONS
KEEP(*(.vector_table))
_text_vectortable_end = .;
*(.text.armcm_boot*)
} > rom
} > rom :text_segment

. = ALIGN(4);
_data_flash = .;
Expand All @@ -41,7 +51,7 @@ SECTIONS
_ram_vectortable_start = .;
. = . + ( _text_vectortable_end - _text_vectortable_start ) ;
_ram_vectortable_end = .;
} > ram
} > ram :ram_vectortable_segment

.data : AT (_data_flash)
{
Expand All @@ -53,7 +63,7 @@ SECTIONS
*(.data .data.*);
. = ALIGN(4);
_data_end = .;
} > ram
} > ram :data_segment

.bss (NOLOAD) :
{
Expand All @@ -63,14 +73,14 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
_bss_end = .;
} > ram
} > ram :bss_segment

_stack_start = CONFIG_RAM_START + CONFIG_RAM_SIZE - CONFIG_STACK_SIZE ;
.stack _stack_start (NOLOAD) :
{
. = . + CONFIG_STACK_SIZE;
_stack_end = .;
} > ram
} > ram :stack_segment

/DISCARD/ : {
// The .init/.fini sections are used by __libc_init_array(), but
Expand Down

0 comments on commit fddf8e9

Please sign in to comment.