This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fe0949ad38fa1b77cc6b973b2883a858b82dc7f9 Author: Huang Qi <huang...@xiaomi.com> AuthorDate: Sun Jan 26 21:08:16 2025 +0800 tools/x86_64: Add LLVM target definitions Summary: - Added LLVM target definitions (`LLVM_ARCH`, `LLVM_CPU`, `LLVM_ABI`) to `arch/x86_64/src/cmake/Toolchain.cmake` and `arch/x86_64/src/common/Toolchain.defs` - These definitions are necessary for compatibility with LLVM-based toolchains and ensure proper target architecture, CPU, and ABI settings Impact: - Enables support for LLVM-based toolchains when building for x86_64 architecture - No functional changes for existing GNU-based toolchains - Improves maintainability by centralizing LLVM-specific configurations in the toolchain files Signed-off-by: Huang Qi <huang...@xiaomi.com> --- arch/x86_64/src/cmake/Toolchain.cmake | 5 +++++ arch/x86_64/src/common/Toolchain.defs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/x86_64/src/cmake/Toolchain.cmake b/arch/x86_64/src/cmake/Toolchain.cmake index 9ed22f1c0d..08dae29449 100644 --- a/arch/x86_64/src/cmake/Toolchain.cmake +++ b/arch/x86_64/src/cmake/Toolchain.cmake @@ -122,6 +122,11 @@ add_compile_options( -Wno-unknown-pragmas $<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>) +# LLVM target definitions +set(LLVM_ARCH "x86_64") +set(LLVM_CPU "x86-64") +set(LLVM_ABI "sysv") + if(CONFIG_CXX_STANDARD) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>) endif() diff --git a/arch/x86_64/src/common/Toolchain.defs b/arch/x86_64/src/common/Toolchain.defs index 5661577374..be3490a122 100644 --- a/arch/x86_64/src/common/Toolchain.defs +++ b/arch/x86_64/src/common/Toolchain.defs @@ -70,6 +70,11 @@ ARCHCPUFLAGS = -fno-pic -mcmodel=large -mno-red-zone -mrdrnd ARCHPICFLAGS = -fPIC ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef +# LLVM target definitions +LLVM_ARCHTYPE := x86_64 +LLVM_CPUTYPE := x86-64 +LLVM_ABITYPE := sysv + # We have to use a cross-development toolchain under Cygwin because the native # Cygwin toolchains don't generate ELF binaries.