Part 1
요약·해설
세 ELF type, ARM shared-library 제한, buffer lifetime·mutation, Xtensa requirement와 SLID main/extension 일치 조건을 설명합니다.
ELF · relocatable · shared
Copy · writable
Name · SLID
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
1EBF089BC9B3642D08D40FBE162214CFA156566692152ED3D1071017FB00F0DC
Configuration
#############
The following Kconfig options are available for the LLEXT subsystem:
.. _llext_kconfig_heap:
Heap size
----------
The LLEXT subsystem needs a static heap to be allocated for extension related
data. The following option controls this allocation.
:kconfig:option:`CONFIG_LLEXT_HEAP_SIZE`
Size of the LLEXT heap in kilobytes.
.. note::
When :ref:`user mode <usermode_api>` is enabled, the heap size must be
large enough to allow the extension sections to be allocated with the
alignment required by the architecture.
.. _llext_kconfig_type:
ELF object type
---------------
The LLEXT subsystem supports loading different types of extensions; the type
can be set by choosing among the following Kconfig options:
:kconfig:option:`CONFIG_LLEXT_TYPE_ELF_OBJECT`
Build and expect relocatable files as binary object type for the LLEXT
subsystem. A single compiler invocation is used to generate the object
file.
:kconfig:option:`CONFIG_LLEXT_TYPE_ELF_RELOCATABLE`
Build and expect relocatable (partially linked) files as the binary
object type for the LLEXT subsystem. These object files are generated
by the linker by combining multiple object files into a single one.
:kconfig:option:`CONFIG_LLEXT_TYPE_ELF_SHAREDLIB`
Build and expect shared libraries as binary object type for the LLEXT
subsystem. The standard linking process is used to generate the shared
library from multiple object files.
.. note::
This is not currently supported on ARM architectures.
.. _llext_kconfig_storage:
Minimize allocations
--------------------
The LLEXT subsystem loading mechanism, by default, uses a seek/read abstraction
and copies all data into allocated memory; this is done to allow the extension
to be loaded from any storage medium. Sometimes, however, data is already in a
buffer in RAM and copying it is not necessary. The following option allows the
LLEXT subsystem to optimize memory footprint in this case.
:kconfig:option:`CONFIG_LLEXT_STORAGE_WRITABLE`
Allow the extension to be loaded by directly referencing section data
into the ELF buffer. To be effective, this requires the use of an ELF
loader that supports the ``peek`` functionality, such as the
:c:struct:`llext_buf_loader`.
.. warning::
The application must ensure that the buffer used to load the
extension remains allocated until the extension is unloaded.
.. note::
This will directly modify the contents of the buffer during the link
phase. Once the extension is unloaded, the buffer must be reloaded
before it can be used again in a call to :c:func:`llext_load`.
.. note::
This is currently required by the Xtensa architecture. Further
information on this topic is available on GitHub issue `#75341
<https://github.com/zephyrproject-rtos/zephyr/issues/75341>`_.
.. _llext_kconfig_slid:
Using SLID for symbol lookups
-----------------------------
When an extension is loaded, the LLEXT subsystem must find the address of all
the symbols residing in the main application that the extension references.
To this end, the main binary contains a LLEXT-dedicated symbol table, filled
with one symbol-name-to-address mapping entry for each symbol exported by the
main application to extensions. This table can then be searched into by the
LLEXT linker at extension load time. This process is pretty slow due to the
nature of string comparisons, and the size consumed by the table can become
significant as the number of exported symbols increases.
:kconfig:option:`CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID`
Perform an extra processing step on the Zephyr binary and on all
extensions being built, converting every string in the symbol tables to
a pointer-sized hash called `Symbol Link Identifier` (SLID), which is
stored in the binary.
This speeds up the symbol lookup process by allowing usage of
integer-based comparisons rather than string-based ones. Another
benefit of SLID-based linking is that storing symbol names in the
binary is no longer necessary, which provides a significant decrease in
symbol table size.
.. note::
This option is not currently compatible with the :ref:`LLEXT EDK
<llext_build_edk>`.
.. note::
Using a different value for this option in the main binary and in
extensions is not supported. For example, if the main application
is built with ``CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y``, it is
forbidden to load an extension that was compiled with
``CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=n``.
EDK configuration
-----------------
Options influencing the generation and behavior of the LLEXT EDK are described
in :ref:`llext_kconfig_edk`.
Part 3
한국어 전문 번역
LLEXT subsystem에는 다음 Kconfig option이 있습니다.
Heap size
LLEXT subsystem은 extension 관련 data를 위해 static heap을 할당해야 합니다.
CONFIG_LLEXT_HEAP_SIZE- LLEXT heap size를 kilobyte 단위로 지정합니다.
ELF object type
LLEXT subsystem이 build하고 load할 extension type은 다음 Kconfig option 중 하나로 선택합니다.
CONFIG_LLEXT_TYPE_ELF_OBJECT- Relocatable file을 LLEXT binary object type으로 사용합니다. Compiler invocation 한 번으로 object file을 만듭니다.
CONFIG_LLEXT_TYPE_ELF_RELOCATABLE- 부분 link된 relocatable file을 사용합니다. Linker가 object file 여러 개를 하나로 결합해 만듭니다.
CONFIG_LLEXT_TYPE_ELF_SHAREDLIB- Shared library를 사용합니다. Standard linking process로 object file 여러 개를 shared library로 만듭니다. 현재 ARM architecture에서는 지원하지 않습니다.
Allocation 최소화
기본 LLEXT loader는 seek/read abstraction으로 모든 data를 allocated memory에 복사합니다. 어떤 storage medium에서도 extension을 load하기 위한 설계입니다. ELF data가 이미 RAM buffer에 있다면 복사가 불필요하므로 다음 option으로 memory footprint를 줄일 수 있습니다.
CONFIG_LLEXT_STORAGE_WRITABLE- ELF buffer의 section data를 직접 참조해 extension을 load할 수 있게 합니다. 효과를 내려면
peek을 지원하는llext_buf_loader같은 ELF loader가 필요합니다.
이 option은 현재 Xtensa architecture에 필요합니다. 관련 배경은 Zephyr GitHub issue #75341에 있습니다.
Symbol lookup에 SLID 사용
Extension을 load할 때 LLEXT subsystem은 extension이 참조하는 main application symbol의 address를 모두 찾아야 합니다. Main binary에는 application이 extension에 export한 symbol마다 name-to-address entry가 있는 LLEXT 전용 symbol table이 들어 있습니다. LLEXT linker는 load time에 이 table을 검색합니다. String comparison 특성상 속도가 느리고 exported symbol이 많아지면 table size도 커집니다.
CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID- Zephyr binary와 build 중인 모든 extension을 추가 처리해 symbol table string을 pointer 크기의 hash인 Symbol Link Identifier(SLID)로 바꾸고 binary에 저장합니다.
SLID를 사용하면 string 대신 integer comparison으로 symbol lookup이 빨라집니다. Binary에 symbol name을 저장하지 않아도 되므로 symbol table size도 크게 줄어듭니다.
EDK configuration
LLEXT EDK 생성과 동작을 바꾸는 option은 build 문서의 LLEXT EDK Kconfig 절에서 설명합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.