-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update build system for native loadable modules #8399
Conversation
softwarecki
commented
Oct 26, 2023
- Changed the compiler used to build loadable modules to clang.
- Update path to rimage include directory
- Added a necessary symbols in the linker script which allows use a memory allocation functions from libc (malloc, calloc, etc.).
- Changed linker options to enable linking with libgcc and libc.
- Suggested rimage to ignore lack of the .bss section in loadable modules.
- Removed alignment of .rodata section,
- Changed .module section flags using objcopy to ignore it by rimage
Changed the compiler used to build loadable modules to clang. It has been used for a long time to build sof. The latest xtensa toolchain no longer has xcc compiler. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
As rimage was moved to sof repository it is necessary to update path to rimage include directory in lmdk build system. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit adds a necessary symbols in the linker script which allows use a memory allocation functions from libc (malloc, calloc, etc.) in loadable modules. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok except the .rodata alignment removal question.
Changed linker options to enable linking with libgcc and libc. This change is required to allow use compiler builtins functions (like __divdi3) and dynamic memory allocation functions. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Loadable libraries do not need to have a .bss section. After this change, its absence will be ignored when generating a image of the loadable module. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
The .data and .rodata sections are placed by rimage into one segment of a resulting firmware image. So aligning the .rodata section to the page boundary is just a waste of memory. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
The .module section contains the module manifest read by rimage. It should not be included in the final loadable module image. Flags of this section are now modified using objcopy to ignore it by rimage. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2e08e3f
to
2943138
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do need to keep our client module API consistent between built-in and module, having reduced API surface and limitations around resources for modules vs built-in is going to be difficult. The latter could be solved by making sure we have some resource allocation API available in the services.
At the beginning of the .text section there must be a structure containing information about the version of the api used by the library. It's absence will cause sof to interpret a random literal as a version and incorrectly load a library. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we just need to Kconfig and Cmake comments (and maybe in main lmdk header), more of a reminder for developers when they debug i.e. have you manually confirmed you are using same config for base FW and modules before further debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumptions on xtensa and particular toolchain limit applicability of lmdk quite a bit, but I don't see this PR really making this aspect more/less severe, so no have no particular objections to this PR.