diff --git a/elfloader-tool/src/arch-riscv/linker.lds b/elfloader-tool/src/arch-riscv/linker.lds index 0c5eeba9..2076b71a 100644 --- a/elfloader-tool/src/arch-riscv/linker.lds +++ b/elfloader-tool/src/arch-riscv/linker.lds @@ -4,6 +4,13 @@ * SPDX-License-Identifier: GPL-2.0-only */ +/* + * NOTE: For RISC-V 32-bit, having the .rodata section before the .data section causes the elfloader to + * freeze up. Thus, for 32-bit we move the .rodata section to after the .bss section as previously + * before some refactoring. The 64-bit version does not seem to be affect by this issue and uses thus + * uses the new layout. + */ + #include <autoconf.h> #include <elfloader/gen_config.h> #include "image_start_addr.h" @@ -22,6 +29,7 @@ SECTIONS { *(.text) } +#ifdef CONFIG_ARCH_RISCV64 . = ALIGN(16); .rodata : { @@ -37,6 +45,7 @@ SECTIONS *(._archive_cpio) _archive_end = .; } +#endif . = ALIGN(16); .data : { @@ -54,5 +63,22 @@ SECTIONS *(.bss.*) _bss_end = .; } +#ifdef CONFIG_ARCH_RISCV32 + . = ALIGN(16); + .rodata : + { + *(.srodata*) + . = ALIGN(16); + *(.rodata) + *(.rodata.*) + /* + * ld crashes when we add this here: *(_driver_list) + */ + . = ALIGN(16); + _archive_start = .; + *(._archive_cpio) + _archive_end = .; + } +#endif _end = .; }