mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
modlib: Implement sh_addralign handling
I've seen a module with 16 bytes .rodata alignment for xmm operations. It was getting SEGV on sim/Linux because of the alignment issue. The same module binary seems working fine after applying this patch. Also, tested on sim/macOS and esp32 on qemu, using a module with an artificially large alignment. (64 bytes)
This commit is contained in:
committed by
Xiang Xiao
parent
7813b4f88a
commit
51490bad55
@@ -730,15 +730,15 @@ void up_module_text_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_module_text_alloc
|
||||
* Name: up_module_text_memalign
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for module text.
|
||||
* Allocate memory for module text with the specified alignment.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_USE_MODULE_TEXT)
|
||||
FAR void *up_module_text_alloc(size_t size);
|
||||
FAR void *up_module_text_memalign(size_t align, size_t size);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -198,6 +198,8 @@ struct mod_loadinfo_s
|
||||
uintptr_t datastart; /* Start of.bss/.data memory in .text allocation */
|
||||
size_t textsize; /* Size of the module .text memory allocation */
|
||||
size_t datasize; /* Size of the module .bss/.data memory allocation */
|
||||
size_t textalign; /* Necessary alignment of .text */
|
||||
size_t dataalign; /* Necessary alignment of .bss/.text */
|
||||
off_t filelen; /* Length of the entire module file */
|
||||
Elf_Ehdr ehdr; /* Buffered module file header */
|
||||
FAR Elf_Shdr *shdr; /* Buffered module section headers */
|
||||
|
||||
Reference in New Issue
Block a user