sim: Align LLVM target info across CMake and Makefile

Summary:
- Unified the specification of LLVM architecture and ABI types across the CMake and Makefile configurations.
- Introduced `LLVM_ARCHTYPE` and `LLVM_CPUTYPE` variables in the CMake configuration to match the Makefile's approach.
- Standardized the ABI type (`LLVM_ABITYPE`) to `sysv` for both Linux and macOS host configurations.

Impact:
- Ensures consistent LLVM target definitions across build systems (CMake and Makefile).
- Simplifies future maintenance by avoiding divergence in LLVM-related configurations.
- No functional changes to the build output; only the internal representation of LLVM target information is aligned.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2025-01-27 10:59:14 +08:00 committed by Xiang Xiao
parent 689aa55e01
commit a2e8bb83a4
2 changed files with 28 additions and 2 deletions

View file

@ -29,6 +29,32 @@ if(WIN32)
return()
endif()
# LLVM style architecture flags
if(CONFIG_HOST_X86_64)
if(CONFIG_SIM_M32)
set(LLVM_ARCHTYPE "x86")
set(LLVM_CPUTYPE "i686")
else()
set(LLVM_ARCHTYPE "x86_64")
set(LLVM_CPUTYPE "skylake")
endif()
elseif(CONFIG_HOST_X86_32)
set(LLVM_ARCHTYPE "x86")
set(LLVM_CPUTYPE "i686")
elseif(CONFIG_HOST_ARM64)
set(LLVM_ARCHTYPE "aarch64")
set(LLVM_CPUTYPE "cortex-a53")
elseif(CONFIG_HOST_ARM)
set(LLVM_ARCHTYPE "arm")
set(LLVM_CPUTYPE "cortex-a9")
endif()
if(CONFIG_HOST_LINUX OR CONFIG_HOST_MACOS)
set(LLVM_ABITYPE "sysv")
elseif(WIN32)
set(LLVM_ABITYPE "msvc")
endif()
# NuttX is sometimes built as a native target. In that case, the __NuttX__ macro
# is predefined by the compiler. https://github.com/NuttX/buildroot
#

View file

@ -179,9 +179,9 @@ else ifeq ($(CONFIG_HOST_ARM),y)
endif
ifeq ($(CONFIG_HOST_LINUX),y)
LLVM_ABITYPE := gnu
LLVM_ABITYPE := sysv
else ifeq ($(CONFIG_HOST_MACOS),y)
LLVM_ABITYPE := darwin
LLVM_ABITYPE := sysv
endif
ARCHPICFLAGS = -fpic