Skip to content

Commit 1d83962

Browse files
committed
[libc] Add support for hexagon architecture, hexagon-linux
The start.cpp is a WIP, might make sense to abstract some of the commonalities among hexagon and x86_64? The sin, cos, tan entrypoints are omitted to avoid a build error. I think we might need a target-independent implementation of these?
1 parent a0a41d1 commit 1d83962

File tree

25 files changed

+1091
-10
lines changed

25 files changed

+1091
-10
lines changed

libc/cmake/modules/LLVMLibCArchitectures.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
5959
set(target_arch "riscv32")
6060
elseif(target_arch MATCHES "^riscv64")
6161
set(target_arch "riscv64")
62+
elseif(target_arch MATCHES "^hexagon")
63+
set(target_arch "hexagon")
6264
else()
6365
return()
6466
endif()
@@ -156,6 +158,8 @@ elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "riscv64")
156158
elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "riscv32")
157159
set(LIBC_TARGET_ARCHITECTURE_IS_RISCV32 TRUE)
158160
set(LIBC_TARGET_ARCHITECTURE "riscv")
161+
elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "hexagon")
162+
set(LIBC_TARGET_ARCHITECTURE_IS_HEXAGON TRUE)
159163
else()
160164
message(FATAL_ERROR
161165
"Unsupported libc target architecture ${LIBC_TARGET_ARCHITECTURE}")

libc/config/linux/app.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ struct TLSImage {
3737

3838
#if defined(LIBC_TARGET_ARCH_IS_X86_64) || \
3939
defined(LIBC_TARGET_ARCH_IS_AARCH64) || \
40-
defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
40+
defined(LIBC_TARGET_ARCH_IS_ANY_RISCV) || \
41+
defined(LIBC_TARGET_ARCH_IS_HEXAGON)
4142
// At the language level, argc is an int. But we use uint64_t as the x86_64
4243
// ABI specifies it as an 8 byte value. Likewise, in the ARM64 ABI, arguments
4344
// are usually passed in registers. x0 is a doubleword register, so this is
44-
// 64 bit for aarch64 as well.
45+
// 64 bit for aarch64 as well. For hexagon, argc is an int and uintptr_t
46+
// is 32-bits so the size will correspond.
4547
typedef uintptr_t ArgcType;
4648

4749
// At the language level, argv is a char** value. However, we use uint64_t as

0 commit comments

Comments
 (0)