-
Notifications
You must be signed in to change notification settings - Fork 7k
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 new inspection API #85498
Merged
kartben
merged 3 commits into
zephyrproject-rtos:main
from
pillo79:pr-llext-inspect-api
Feb 13, 2025
Merged
llext: add new inspection API #85498
kartben
merged 3 commits into
zephyrproject-rtos:main
from
pillo79:pr-llext-inspect-api
Feb 13, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7832db1
to
e9c78e0
Compare
0f1f3db
to
b995e8b
Compare
lyakh
reviewed
Feb 11, 2025
This is required for the functions that inspect the ELF file to work properly. The user must then call llext_free_inspection_data() before calling llext_unload() to free the memory left allocated in the loader and extension memory. Signed-off-by: Luca Burelli <[email protected]>
b995e8b
to
a4f4f35
Compare
teburd
previously approved these changes
Feb 11, 2025
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.
Seems reasonable, though there are definitely some footguns to be found here if you aren't careful.
a4f4f35
to
a32e6bf
Compare
Add APIs to inspect the contents of an ELF file loaded as an extension. This is useful for applications that need to access the contents of the extension in a more fine-grained way than the existing LLEXT APIs. Use of these APIs requires the 'keep_elf_data' option to be provided via struct llext_load_param to the 'llext_load()' call. Signed-off-by: Luca Burelli <[email protected]>
This patch adds a test suite for the inspection API. The test checks that the symbols exported by the 'inspect_ext' extension are correctly mapped inside their corresponding regions and sections. Signed-off-by: Luca Burelli <[email protected]>
a32e6bf
to
e693208
Compare
Sorry for the noise, force pushed a change to the wrong repo 😅 |
teburd
approved these changes
Feb 11, 2025
nashif
approved these changes
Feb 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
This PR introduces a new set of functions that allows applications to access internal details about the loaded extensions.
In particular, these new functions allows access to data related to the ELF file sections (and their runtime location, if they got picked up by the LLEXT loader):
llext_get_region_info()
function that retrieves the region header, its start address and length, given its index;llext_get_section_info()
function that retrieves the ELF section header, its associated region and offset in the region, given its index;llext_section_shndx()
function that returns the index of a section given its name.Using the new APIs requires explicitly asking for this data to be kept after
llext_load
completes via a new load-time parameter. Ifkeep_section_info
is set in the load params, some of the structures will be retained to allow the application to retrieve the required information. This data can later be discarded by calling thellext_free_inspect_data()
function.Use case
This new API is extensively used in thesofproject/sof#9831, to remove the strict dependency of SOF from LLEXT internal structures.
An LLEXT test case that verifies that symbols in different sections map to the expected regions and memory locations are within proper bounds has also been added to the Zephyr test suite.
I would like to include this in 4.1 so the new API is available for full SOF integration testing during the freeze window.