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 <lauren.murphy@intel.com>
27 lines
610 B
CMake
27 lines
610 B
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
if(EXISTS ${SOC_FULL_DIR}/tune_build_ops.cmake)
|
|
include(${SOC_FULL_DIR}/tune_build_ops.cmake)
|
|
endif()
|
|
|
|
if(NOT DEFINED GCC_ARC_TUNED_CPU)
|
|
set(GCC_ARC_TUNED_CPU ${GCC_M_CPU})
|
|
endif()
|
|
|
|
# Flags not supported by llext linker
|
|
# (regexps are supported and match whole word)
|
|
set(LLEXT_REMOVE_FLAGS
|
|
-fno-pic
|
|
-fno-pie
|
|
-ffunction-sections
|
|
-fdata-sections
|
|
-Os
|
|
)
|
|
|
|
set(LLEXT_APPEND_FLAGS
|
|
-mcpu=${GCC_ARC_TUNED_CPU} # Force compiler and linker match
|
|
)
|
|
|
|
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_ARC_TUNED_CPU})
|
|
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_ARC_TUNED_CPU})
|