-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
llext: add build commands and tests for relocatable ELFs #71279
llext: add build commands and tests for relocatable ELFs #71279
Conversation
Add a new Kconfig option to select the binary object type for the llext subsystem. This will allow to fully decouple the architecture type from the kind of binary object that is expected by the loader. The defaults have been chosen to match the current behavior of the ARM and Xtensa architectures, but developers can now more easily experiment with other object types. Signed-off-by: Luca Burelli <[email protected]>
This change allows the `add_llext_target` function to accept multiple source files when building an ELF shared library. The ELF object target type is still limited to a single source file, since there is no linking step in that case. Also fixes a minor typo in another llext function documentation. Signed-off-by: Luca Burelli <[email protected]>
This commit adds support for building relocatable (partially linked) ELF files as the binary object type for the llext subsystem. Signed-off-by: Luca Burelli <[email protected]>
Currently LLEXT on Xtensa supports relocatable extensions, linked for a specific address range, while relocation itself takes place in a temporary buffer. For this section addresses have to be set correctly by the linker for their target locations. This commit adds support for relocatable extensions, built without using specific memory addresses and run at the same addresses, where they are loaded. Signed-off-by: Guennadi Liakhovetski <[email protected]>
LLEXT on Xtensa now supports both shared and relocatable (partially linked) extensions. This commit adds a copy of the LLEXT test for the relocatable case. Signed-off-by: Luca Burelli <[email protected]> Signed-off-by: Guennadi Liakhovetski <[email protected]>
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.
Thanks! Tested locally too.
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.
You're removing message(FATAL_ERROR "add_llext_target: unsupported architecture")
. So isn't that enough to remove the LOADER_BUILD_ONLY
test limitation?
Good idea! I have tried removing the barriers but I get a weird error on
(and all other llext tests). The compiler is missing |
blah blah daemons blah blah Turns out the reason was way clearer - arches where LLEXT is not tested yet do not define an I have this fixed locally, however since the PR is already approved I will open a separate one with this cleanup/refactor as soon as this lands. |
Nice! Well done.
Agreed. Note dropping LOADER_BUILD_ONLY is the ultimate goal BUT if you have it to keep it for some more time and gradually increase the list of architectures that actually run tests instead then it would be great progress too. A first, 64bits arch passing the tests would be an especially big milestone! |
This PR introduces build support in the llext subsystem for relocatable objects, and a Twister test for validating this PR and #70793, which added llext support for them. It is intended to replace #70991 by providing the same result on the new CMake infrastructure merged in #67997.
It does so by:
LLEXT_BINARY_TYPE
Kconfig, to select the build type among object files, relocatable files, or shared libraries, effectively making CMake code for llext almost arch-independent. The automatic defaults are for the tested combinations, but this gives developers more freedom to experiment.add_llext_target
rules to support multiple source files for the binary types that include a link step;