Skip to content

Commit d05991e

Browse files
serhiy-katsyuba-intellgirdwood
authored andcommitted
llext: Fix wrong literals placement in modules
Xtensa L32R instruction requires the literal it loads to be located in memory before the L32R address. Such a requirement is usually satisfied by linker script rules which put literals sections before text sections in which they are used. LLEXT module builds do not use a linker script, and so correct placement of literals is ensured by a compilation option. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent b8f3ccb commit d05991e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zephyr/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ function(sof_llext_build module)
5858
file(WRITE ${PROJECT_BINARY_DIR}/${module}_llext/lib_name.txt ${SOF_LLEXT_LIB})
5959
endif()
6060

61+
if("${ARCH}" STREQUAL "xtensa")
62+
# This makes sure literals are placed in memory before they are used by
63+
# the L32R instruction. Usually this is guaranteed by the linker script.
64+
# However, since a linker script is not used for LLEXT modules builds,
65+
# correct literal placement is ensured with a compilation option here.
66+
set(SOF_LLEXT_CFLAGS ${SOF_LLEXT_CFLAGS} -mtext-section-literals)
67+
endif()
68+
6169
target_include_directories(${module}_llext_lib PRIVATE
6270
"${SOF_BASE}/xtos/include"
6371
"${SOF_BASE}/src/include"

0 commit comments

Comments
 (0)