Skip to content

Commit f0eb7eb

Browse files
laurenmurphyx64kartben
authored andcommitted
llext: arc: enforce bitness match
Enforces bitness match of ARC compilers and linkers invoked building LLEXT apps by inheriting -mcpu flag from Zephyr. The ARC toolchain becomes confused without the -mcpu flag. On qemu_hs5x we see GCC select elf32-littlearc64 for linking an object previously compiled as elf64-littlearc64. Fixes #80949 Signed-off-by: Lauren Murphy <[email protected]>
1 parent 2850be6 commit f0eb7eb

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cmake/compiler/gcc/target_arc.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ set(LLEXT_REMOVE_FLAGS
1818
-Os
1919
)
2020

21+
set(LLEXT_APPEND_FLAGS
22+
-mcpu=${GCC_ARC_TUNED_CPU} # Force compiler and linker match
23+
)
24+
2125
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_ARC_TUNED_CPU})
2226
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_ARC_TUNED_CPU})

tests/subsys/llext/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ if (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE AND NOT CONFIG_ARM AND NOT CONFIG_RISCV)
7575
TARGET pre_located_ext
7676
POST_BUILD
7777
COMMAND ${CMAKE_C_COMPILER}
78+
${LLEXT_APPEND_FLAGS}
7879
-Wl,-r -Wl,-Ttext=0xbada110c -nostdlib -nodefaultlibs -nostartfiles
7980
$<TARGET_OBJECTS:${pre_located_target}> -o ${pre_located_file}
8081
)

0 commit comments

Comments
 (0)