sim: Fix linker support and macOS host build issues

Update SIM configuration and CMake toolchain to resolve
linker errors when building on macOS. Adjust POSIX host
implementation to ensure successful compilation and
proper behavior of the sim target.

Modified:
- arch/sim/Kconfig
- arch/sim/src/cmake/Toolchain.cmake
- arch/sim/src/sim/posix/sim_hostmisc.c

Signed-off-by: Aditya Yadav <166515021+aditya0yadav@users.noreply.github.com>
This commit is contained in:
Aditya Yadav
2026-03-04 21:33:59 +00:00
committed by Xiang Xiao
parent 5cd57fa27e
commit 574fc64ab9
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -37,6 +37,7 @@ config ARCH_CHIP
choice
prompt "Toolchain Selection"
default SIM_TOOLCHAIN_CLANG if HOST_MACOS
default SIM_TOOLCHAIN_GCC
config SIM_TOOLCHAIN_GCC
+7 -2
View File
@@ -20,7 +20,7 @@
#
# ##############################################################################
if(APPLE)
if(APPLE AND CONFIG_SIM_TOOLCHAIN_GCC)
find_program(CMAKE_C_ELF_COMPILER x86_64-elf-gcc)
find_program(CMAKE_CXX_ELF_COMPILER x86_64-elf-g++)
endif()
@@ -121,7 +121,12 @@ if(CONFIG_STACK_USAGE_WARNING)
endif()
if(CONFIG_COVERAGE_ALL)
add_compile_options(-fprofile-arcs -ftest-coverage -fno-inline)
if(CONFIG_ARCH_TOOLCHAIN_GCC)
add_compile_options(-fprofile-arcs -ftest-coverage -fno-inline)
elseif(CONFIG_ARCH_TOOLCHAIN_CLANG)
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
add_link_options(-fprofile-instr-generate)
endif()
endif()
if(CONFIG_PROFILE_ALL OR CONFIG_SIM_PROFILE)
+1
View File
@@ -24,6 +24,7 @@
* Included Files
****************************************************************************/
#include <signal.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>