Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
llext.h File Reference

Support for linkable loadable extensions. More...

#include <zephyr/sys/slist.h>
#include <zephyr/llext/elf.h>
#include <zephyr/llext/symbol.h>
#include <zephyr/kernel.h>
#include <sys/types.h>
#include <stdbool.h>
#include <zephyr/syscalls/llext.h>

Go to the source code of this file.

Data Structures

struct  llext
 Structure describing a linkable loadable extension. More...
 
struct  llext_load_param
 Advanced llext_load parameters. More...
 

Macros

#define LLEXT_MAX_DEPENDENCIES   8
 
#define LLEXT_LOAD_PARAM_DEFAULT   { .relocate_local = true, }
 Default initializer for llext_load_param.
 

Typedefs

typedef void(* llext_entry_fn_t) (void *user_data)
 Entry point function signature for an extension.
 

Enumerations

enum  llext_mem {
  LLEXT_MEM_TEXT , LLEXT_MEM_DATA , LLEXT_MEM_RODATA , LLEXT_MEM_BSS ,
  LLEXT_MEM_EXPORT , LLEXT_MEM_SYMTAB , LLEXT_MEM_STRTAB , LLEXT_MEM_SHSTRTAB ,
  LLEXT_MEM_PREINIT , LLEXT_MEM_INIT , LLEXT_MEM_FINI , LLEXT_MEM_COUNT
}
 List of memory regions stored or referenced in the LLEXT subsystem. More...
 

Functions

static const elf_shdr_tllext_section_headers (const struct llext *ext)
 
static unsigned int llext_section_count (const struct llext *ext)
 
struct llextllext_by_name (const char *name)
 Find an llext by name.
 
int llext_iterate (int(*fn)(struct llext *ext, void *arg), void *arg)
 Iterate over all loaded extensions.
 
int llext_load (struct llext_loader *loader, const char *name, struct llext **ext, const struct llext_load_param *ldr_parm)
 Load and link an extension.
 
int llext_unload (struct llext **ext)
 Unload an extension.
 
int llext_bringup (struct llext *ext)
 Calls bringup functions for an extension.
 
int llext_teardown (struct llext *ext)
 Calls teardown functions for an extension.
 
void llext_bootstrap (struct llext *ext, llext_entry_fn_t entry_fn, void *user_data)
 Bring up, execute, and teardown an extension.
 
ssize_t llext_get_fn_table (struct llext *ext, bool is_init, void *buf, size_t size)
 Get pointers to setup or cleanup functions for an extension.
 
const void * llext_find_sym (const struct llext_symtable *sym_table, const char *sym_name)
 Find the address for an arbitrary symbol.
 
int llext_call_fn (struct llext *ext, const char *sym_name)
 Call a function by name.
 
int llext_add_domain (struct llext *ext, struct k_mem_domain *domain)
 Add an extension to a memory domain.
 
int arch_elf_relocate (elf_rela_t *rel, uintptr_t loc, uintptr_t sym_base_addr, const char *sym_name, uintptr_t load_bias)
 Architecture specific opcode update function.
 
ssize_t llext_find_section (struct llext_loader *loader, const char *search_name)
 Locates an ELF section in the file.
 
int llext_get_section_header (struct llext_loader *loader, struct llext *ext, const char *search_name, elf_shdr_t *shdr)
 Extract ELF section header by name.
 
void arch_elf_relocate_local (struct llext_loader *loader, struct llext *ext, const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset, const struct llext_load_param *ldr_parm)
 Architecture specific function for local binding relocations.
 
void arch_elf_relocate_global (struct llext_loader *loader, struct llext *ext, const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset, const void *link_addr)
 Architecture specific function for global binding relocations.
 

Detailed Description

Support for linkable loadable extensions.

This file describes the APIs for loading and interacting with Linkable Loadable Extensions (LLEXTs) in Zephyr.