Skip to content

Commit

Permalink
tools/x86_64: Add LLVM target definitions
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
no1wudi committed Jan 26, 2025
1 parent 1ee23b5 commit 9deb377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/x86_64/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "elf")

if(CONFIG_CXX_STANDARD)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=${CONFIG_CXX_STANDARD}>)
endif()
Expand Down
5 changes: 5 additions & 0 deletions arch/x86_64/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 9deb377

Please sign in to comment.