Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Linkable loadable extensions

Linkable loadable extensions. More...

Modules

 ELF data types and defines
 ELF types and parsing.
 
 LLEXT symbols
 Linkable loadable extension symbol.
 
 Linkable loadable extensions buffer loader
 LLEXT buffer loader.
 
 Loader context for llext
 Loader context for llext.
 

Data Structures

struct  llext
 Linkable loadable extension. More...
 

Enumerations

enum  llext_mem {
  LLEXT_MEM_TEXT , LLEXT_MEM_DATA , LLEXT_MEM_RODATA , LLEXT_MEM_BSS ,
  LLEXT_MEM_COUNT
}
 Enum of memory regions for lookup tables. More...
 

Functions

sys_slist_tllext_list (void)
 List head of loaded extensions.
 
struct llextllext_by_name (const char *name)
 Find an llext by name.
 
int llext_load (struct llext_loader *loader, const char *name, struct llext **ext)
 Load and link an extension.
 
void llext_unload (struct llext *ext)
 Unload an extension.
 
const void *const llext_find_sym (const struct llext_symtable *sym_table, const char *sym_name)
 Find the address for an arbitrary symbol name.
 
int llext_call_fn (struct llext *ext, const char *sym_name)
 Call a function by name.
 
void arch_elf_relocate (elf_rel_t *rel, uintptr_t opaddr, uintptr_t opval)
 Architecture specific function for updating op codes given a relocation.
 

Detailed Description

Linkable loadable extensions.

Enumeration Type Documentation

◆ llext_mem

enum llext_mem

#include <zephyr/llext/llext.h>

Enum of memory regions for lookup tables.

Enumerator
LLEXT_MEM_TEXT 
LLEXT_MEM_DATA 
LLEXT_MEM_RODATA 
LLEXT_MEM_BSS 
LLEXT_MEM_COUNT 

Function Documentation

◆ arch_elf_relocate()

void arch_elf_relocate ( elf_rel_t rel,
uintptr_t  opaddr,
uintptr_t  opval 
)

#include <zephyr/llext/llext.h>

Architecture specific function for updating op codes given a relocation.

Elf files contain a series of relocations described in a section. These relocation instructions are architecture specific and each architecture supporting extensions must implement this. They are instructions on how to rewrite opcodes given the actual placement of some symbolic data such as a section, function, or object.

Parameters
[in]relRelocation data provided by elf
[in]opaddrAddress of operation to rewrite with relocation
[in]opvalValue of looked up symbol to relocate

◆ llext_by_name()

struct llext * llext_by_name ( const char *  name)

#include <zephyr/llext/llext.h>

Find an llext by name.

Parameters
[in]nameString name of the llext
Return values
NULLif no llext not found
llextif llext found

◆ llext_call_fn()

int llext_call_fn ( struct llext ext,
const char *  sym_name 
)

#include <zephyr/llext/llext.h>

Call a function by name.

Expects a symbol representing a void fn(void) style function exists and may be called.

Parameters
[in]extExtension to call function in
[in]sym_nameFunction name (exported symbol) in the extension
Return values
0success
-EINVALinvalid symbol name

◆ llext_find_sym()

const void *const llext_find_sym ( const struct llext_symtable sym_table,
const char *  sym_name 
)

#include <zephyr/llext/llext.h>

Find the address for an arbitrary symbol name.

Parameters
[in]sym_tableSymbol table to lookup symbol in, if NULL uses base table
[in]sym_nameSymbol name to find
Return values
NULLif no symbol found
addrAddress of symbol in memory if found

◆ llext_list()

sys_slist_t * llext_list ( void  )

#include <zephyr/llext/llext.h>

List head of loaded extensions.

◆ llext_load()

int llext_load ( struct llext_loader loader,
const char *  name,
struct llext **  ext 
)

#include <zephyr/llext/llext.h>

Load and link an extension.

Loads relevant ELF data into memory and provides a structure to work with it.

Only relocatable ELF files are currently supported (partially linked).

Parameters
[in]loaderAn extension loader that provides input data and context
[in]nameA string identifier for the extension
[out]extA pointer to a statically allocated llext struct
Return values
0Success
-ENOMEMNot enough memory
-EINVALInvalid ELF stream

◆ llext_unload()

void llext_unload ( struct llext ext)

#include <zephyr/llext/llext.h>

Unload an extension.

Parameters
[in]extExtension to unload