2c0eecaa5e
This change enables specific compiler and linker options to be used in the case that an arch/posix/os.arch.cmake file exists. Note: os and arch in the above case are evaluations of CMAKE_HOST_SYSTEM_NAME and CMAKE_HOST_SYSTEM_PROCESSOR. Otherwise, the existing "generic" compiler and linker flags in arch/posix/CMakeLists.txt are used. Additional flags and checks are provided in arch/posix/Linux.aarch64.cmake. Added scripts/user_wordsize.py to detect if userspace is 64-bit or 32-bit, which should be consistent with the value of CONFIG_64BIT for Aarch64 on Linux. Fixes #24842 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
35 lines
1.1 KiB
CMake
35 lines
1.1 KiB
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# For Aarch64, multilib is not an actively pursued solution for most Linux
|
|
# distributions. Userspace is (generally) either 32-bit or 64-bit but not
|
|
# both.
|
|
|
|
# @Intent: Call a script to get userspace wordsize for comparison with CONFIG_64BIT
|
|
execute_process(
|
|
COMMAND
|
|
${PYTHON_EXECUTABLE}
|
|
${ZEPHYR_BASE}/scripts/user_wordsize.py
|
|
OUTPUT_VARIABLE
|
|
WORDSIZE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
|
|
if (CONFIG_64BIT)
|
|
if (${WORDSIZE} STREQUAL "32")
|
|
message(FATAL_ERROR
|
|
"CONFIG_64BIT=y but this Aarch64 machine has a 32-bit userspace.\n"
|
|
"If you were targeting native_posix_64, target native_posix instead.\n"
|
|
"Otherwise, be sure to define CONFIG_64BIT appropriately.\n"
|
|
)
|
|
endif()
|
|
zephyr_compile_options(-fPIC)
|
|
else ()
|
|
if (${WORDSIZE} STREQUAL "64")
|
|
message(FATAL_ERROR
|
|
"CONFIG_64BIT=n but this Aarch64 machine has a 64-bit userspace.\n"
|
|
"If you were targeting native_posix, target native_posix_64 instead.\n"
|
|
"Otherwise, be sure to define CONFIG_64BIT appropriately.\n"
|
|
)
|
|
endif()
|
|
endif ()
|