-
Notifications
You must be signed in to change notification settings - Fork 15.4k
draft: libc support for hexagon linux #81815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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?
These are all useful for making the build / tests pass but need some official resolution. * explicit CMAKE_CROSSCOMPILING_EMULATOR - normally this shouldn't be required * missing `wint_t` typedef. known/outstanding issue llvm#63510 ? * workaround for missing `-nolibc` in the toolchain * adjust timeouts for LibcDeathTestExecutors - test under emulation takes longer
This change is required to fix this error:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/stdio/printf_core/converter.cpp:9:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/stdio/printf_core/converter.h:12:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/stdio/printf_core/core_structs.h:13:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/__support/FPUtil/FPBits.h:17:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/__support/FPUtil/FloatProperties.h:12:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/__support/UInt128.h:12:
In file included from /local/mnt/workspace/upstream/llvm-project/libc/src/__support/UInt.h:17:
/local/mnt/workspace/upstream/llvm-project/libc/src/__support/integer_utils.h:51:13: error: use of undeclared identifier 'add_with_carry'
51 | auto r1 = add_with_carry(prod.lo, lo_hi.lo << 32, uint64_t(0));
| ^
/local/mnt/workspace/upstream/llvm-project/libc/src/__support/integer_utils.h:55:13: error: use of undeclared identifier 'add_with_carry'
55 | auto r2 = add_with_carry(prod.lo, hi_lo.lo << 32, uint64_t(0));
| ^
|
@llvm/pr-subscribers-libc Author: Brian Cain (androm3da) Changes<this PR not in a useful state for review> Patch is 50.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/81815.diff 30 Files Affected:
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 9c82db754b5f73..b3107b95d396fc 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -269,6 +269,11 @@ if(LLVM_LIBC_ENABLE_LINTING)
endif()
endif()
+if(LIBC_TARGET_ARCHITECTURE STREQUAL "hexagon")
+ add_compile_options(-mlong-calls)
+endif()
+
+
option(LLVM_LIBC_INCLUDE_SCUDO "Include the SCUDO standalone as the allocator for LLVM libc" OFF)
if(LLVM_LIBC_INCLUDE_SCUDO)
if (NOT ("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES))
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 10571101a34178..de223ce52963ed 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -59,6 +59,8 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
set(target_arch "riscv32")
elseif(target_arch MATCHES "^riscv64")
set(target_arch "riscv64")
+ elseif(target_arch MATCHES "^hexagon")
+ set(target_arch "hexagon")
else()
return()
endif()
@@ -156,6 +158,8 @@ elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "riscv64")
elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "riscv32")
set(LIBC_TARGET_ARCHITECTURE_IS_RISCV32 TRUE)
set(LIBC_TARGET_ARCHITECTURE "riscv")
+elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "hexagon")
+ set(LIBC_TARGET_ARCHITECTURE_IS_HEXAGON TRUE)
else()
message(FATAL_ERROR
"Unsupported libc target architecture ${LIBC_TARGET_ARCHITECTURE}")
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 6cae0859149d54..45647106d19c4b 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -212,7 +212,7 @@ function(create_libc_unittest fq_target_name)
if(NOT LIBC_UNITTEST_NO_RUN_POSTBUILD)
add_custom_target(
${fq_target_name}
- COMMAND ${fq_build_target_name}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${fq_build_target_name}
COMMENT "Running unit test ${fq_target_name}"
)
endif()
@@ -538,9 +538,12 @@ function(add_integration_test test_name)
if(LIBC_TARGET_ARCHITECTURE_IS_GPU)
target_link_options(${fq_build_target_name} PRIVATE -nostdlib -static)
+ elseif(LIBC_TARGET_ARCHITECTURE_IS_HEXAGON)
+ target_link_options(${fq_build_target_name} PRIVATE -nostdlib -static -lclang_rt.builtins-hexagon)
else()
target_link_options(${fq_build_target_name} PRIVATE -nolibc -nostartfiles -nostdlib++ -static)
endif()
+
target_link_libraries(
${fq_build_target_name}
# The NVIDIA 'nvlink' linker does not currently support static libraries.
@@ -571,7 +574,7 @@ function(add_integration_test test_name)
$<TARGET_FILE:${fq_build_target_name}> ${INTEGRATION_TEST_ARGS})
add_custom_target(
${fq_target_name}
- COMMAND ${test_cmd}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${test_cmd}
COMMAND_EXPAND_LISTS
COMMENT "Running integration test ${fq_target_name}"
)
@@ -737,7 +740,7 @@ function(add_libc_hermetic_test test_name)
$<TARGET_FILE:${fq_build_target_name}> ${HERMETIC_TEST_ARGS})
add_custom_target(
${fq_target_name}
- COMMAND ${test_cmd}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${test_cmd}
COMMAND_EXPAND_LISTS
COMMENT "Running hermetic test ${fq_target_name}"
${LIBC_HERMETIC_TEST_JOB_POOL}
diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h
index b17026a7832a3c..dcbac7ed44a94f 100644
--- a/libc/config/linux/app.h
+++ b/libc/config/linux/app.h
@@ -37,11 +37,13 @@ struct TLSImage {
#if defined(LIBC_TARGET_ARCH_IS_X86_64) || \
defined(LIBC_TARGET_ARCH_IS_AARCH64) || \
- defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
+ defined(LIBC_TARGET_ARCH_IS_ANY_RISCV) || \
+ defined(LIBC_TARGET_ARCH_IS_HEXAGON)
// At the language level, argc is an int. But we use uint64_t as the x86_64
// ABI specifies it as an 8 byte value. Likewise, in the ARM64 ABI, arguments
// are usually passed in registers. x0 is a doubleword register, so this is
-// 64 bit for aarch64 as well.
+// 64 bit for aarch64 as well. For hexagon, argc is an int and uintptr_t
+// is 32-bits so the size will correspond.
typedef uintptr_t ArgcType;
// At the language level, argv is a char** value. However, we use uint64_t as
diff --git a/libc/config/linux/hexagon/entrypoints.txt b/libc/config/linux/hexagon/entrypoints.txt
new file mode 100644
index 00000000000000..053667edf6d866
--- /dev/null
+++ b/libc/config/linux/hexagon/entrypoints.txt
@@ -0,0 +1,543 @@
+set(TARGET_LIBC_ENTRYPOINTS
+ # ctype.h entrypoints
+ libc.src.ctype.isalnum
+ libc.src.ctype.isalpha
+ libc.src.ctype.isascii
+ libc.src.ctype.isblank
+ libc.src.ctype.iscntrl
+ libc.src.ctype.isdigit
+ libc.src.ctype.isgraph
+ libc.src.ctype.islower
+ libc.src.ctype.isprint
+ libc.src.ctype.ispunct
+ libc.src.ctype.isspace
+ libc.src.ctype.isupper
+ libc.src.ctype.isxdigit
+ libc.src.ctype.toascii
+ libc.src.ctype.tolower
+ libc.src.ctype.toupper
+
+ # errno.h entrypoints
+ libc.src.errno.errno
+
+ # fcntl.h entrypoints
+ libc.src.fcntl.creat
+ libc.src.fcntl.open
+ libc.src.fcntl.openat
+
+ # sched.h entrypoints
+ libc.src.sched.sched_get_priority_max
+ libc.src.sched.sched_get_priority_min
+ libc.src.sched.sched_getaffinity
+ libc.src.sched.sched_getparam
+ libc.src.sched.sched_getscheduler
+ libc.src.sched.sched_rr_get_interval
+ libc.src.sched.sched_setaffinity
+ libc.src.sched.sched_setparam
+ libc.src.sched.sched_setscheduler
+ libc.src.sched.sched_yield
+
+ # string.h entrypoints
+ libc.src.string.bcmp
+ libc.src.string.bcopy
+ libc.src.string.bzero
+ libc.src.string.index
+ libc.src.string.memccpy
+ libc.src.string.memchr
+ libc.src.string.memcmp
+ libc.src.string.memcpy
+ libc.src.string.memmem
+ libc.src.string.memmove
+ libc.src.string.mempcpy
+ libc.src.string.memrchr
+ libc.src.string.memset
+ libc.src.string.rindex
+ libc.src.string.stpcpy
+ libc.src.string.stpncpy
+ libc.src.string.strcasecmp
+ libc.src.string.strcasestr
+ libc.src.string.strcat
+ libc.src.string.strchr
+ libc.src.string.strchrnul
+ libc.src.string.strcmp
+ libc.src.string.strcoll
+ libc.src.string.strcpy
+ libc.src.string.strcspn
+ libc.src.string.strdup
+ libc.src.string.strerror
+ libc.src.string.strerror_r
+ libc.src.string.strlcat
+ libc.src.string.strlcpy
+ libc.src.string.strlen
+ libc.src.string.strncasecmp
+ libc.src.string.strncat
+ libc.src.string.strncmp
+ libc.src.string.strncpy
+ libc.src.string.strndup
+ libc.src.string.strnlen
+ libc.src.string.strpbrk
+ libc.src.string.strrchr
+ libc.src.string.strsep
+ libc.src.string.strsignal
+ libc.src.string.strspn
+ libc.src.string.strstr
+ libc.src.string.strtok
+ libc.src.string.strtok_r
+ libc.src.string.strxfrm
+
+ # inttypes.h entrypoints
+ libc.src.inttypes.imaxabs
+ libc.src.inttypes.imaxdiv
+ libc.src.inttypes.strtoimax
+ libc.src.inttypes.strtoumax
+
+ # stdlib.h entrypoints
+ libc.src.stdlib.abs
+ libc.src.stdlib.atoi
+ libc.src.stdlib.atof
+ libc.src.stdlib.atol
+ libc.src.stdlib.atoll
+ libc.src.stdlib.bsearch
+ libc.src.stdlib.div
+ libc.src.stdlib.labs
+ libc.src.stdlib.ldiv
+ libc.src.stdlib.llabs
+ libc.src.stdlib.lldiv
+ libc.src.stdlib.qsort
+ libc.src.stdlib.qsort_r
+ libc.src.stdlib.rand
+ libc.src.stdlib.srand
+ libc.src.stdlib.strtod
+ libc.src.stdlib.strtof
+ libc.src.stdlib.strtol
+ libc.src.stdlib.strtold
+ libc.src.stdlib.strtoll
+ libc.src.stdlib.strtoul
+ libc.src.stdlib.strtoull
+
+ # stdlib.h external entrypoints
+ libc.src.stdlib.malloc
+ libc.src.stdlib.calloc
+ libc.src.stdlib.realloc
+ libc.src.stdlib.aligned_alloc
+ libc.src.stdlib.free
+
+ # stdio.h entrypoints
+ libc.src.stdio.remove
+ libc.src.stdio.sprintf
+ libc.src.stdio.snprintf
+ libc.src.stdio.fprintf
+ libc.src.stdio.printf
+ libc.src.stdio.vsprintf
+ libc.src.stdio.vsnprintf
+ libc.src.stdio.vfprintf
+ libc.src.stdio.vprintf
+
+ # sys/mman.h entrypoints
+ libc.src.sys.mman.madvise
+ libc.src.sys.mman.mmap
+ libc.src.sys.mman.mprotect
+ libc.src.sys.mman.munmap
+ libc.src.sys.mman.posix_madvise
+
+ # sys/random.h entrypoints
+ libc.src.sys.random.getrandom
+
+ # sys/resource.h entrypoints
+ libc.src.sys.resource.getrlimit
+ libc.src.sys.resource.setrlimit
+
+ # sys/sendfile entrypoints
+ libc.src.sys.sendfile.sendfile
+
+ # sys/socket.h entrypoints
+ libc.src.sys.socket.socket
+
+ # sys/stat.h entrypoints
+ libc.src.sys.stat.chmod
+ libc.src.sys.stat.fchmod
+ libc.src.sys.stat.fchmodat
+ libc.src.sys.stat.fstat
+ libc.src.sys.stat.lstat
+ libc.src.sys.stat.mkdir
+ libc.src.sys.stat.mkdirat
+ libc.src.sys.stat.stat
+
+ # sys/utsname.h entrypoints
+ libc.src.sys.utsname.uname
+
+ # sys/wait.h entrypoints
+ libc.src.sys.wait.wait
+ libc.src.sys.wait.wait4
+ libc.src.sys.wait.waitpid
+
+ # termios.h entrypoints
+ libc.src.termios.cfgetispeed
+ libc.src.termios.cfgetospeed
+ libc.src.termios.cfsetispeed
+ libc.src.termios.cfsetospeed
+ libc.src.termios.tcgetattr
+ libc.src.termios.tcgetsid
+ libc.src.termios.tcdrain
+ libc.src.termios.tcflow
+ libc.src.termios.tcflush
+ libc.src.termios.tcsendbreak
+ libc.src.termios.tcsetattr
+
+ # unistd.h entrypoints
+ libc.src.unistd.access
+ libc.src.unistd.chdir
+ libc.src.unistd.close
+ libc.src.unistd.dup
+ libc.src.unistd.dup2
+ libc.src.unistd.dup3
+ libc.src.unistd.execve
+ libc.src.unistd.fchdir
+ libc.src.unistd.fsync
+ libc.src.unistd.ftruncate
+ libc.src.unistd.getcwd
+ libc.src.unistd.geteuid
+ libc.src.unistd.getpid
+ libc.src.unistd.getppid
+ libc.src.unistd.getuid
+ libc.src.unistd.isatty
+ libc.src.unistd.link
+ libc.src.unistd.linkat
+ libc.src.unistd.lseek
+ libc.src.unistd.pread
+ libc.src.unistd.pwrite
+ libc.src.unistd.read
+ libc.src.unistd.readlink
+ libc.src.unistd.readlinkat
+ libc.src.unistd.rmdir
+ libc.src.unistd.symlink
+ libc.src.unistd.symlinkat
+ libc.src.unistd.sysconf
+ libc.src.unistd.truncate
+ libc.src.unistd.unlink
+ libc.src.unistd.unlinkat
+ libc.src.unistd.write
+
+ # wchar.h entrypoints
+ libc.src.wchar.wctob
+)
+
+set(TARGET_LIBM_ENTRYPOINTS
+ # fenv.h entrypoints
+ libc.src.fenv.feclearexcept
+ libc.src.fenv.fedisableexcept
+ libc.src.fenv.feenableexcept
+ libc.src.fenv.fegetenv
+ libc.src.fenv.fegetexcept
+ libc.src.fenv.fegetexceptflag
+ libc.src.fenv.fegetround
+ libc.src.fenv.feholdexcept
+ libc.src.fenv.fesetenv
+ libc.src.fenv.fesetexceptflag
+ libc.src.fenv.fesetround
+ libc.src.fenv.feraiseexcept
+ libc.src.fenv.fetestexcept
+ libc.src.fenv.feupdateenv
+
+ # math.h entrypoints
+ libc.src.math.acosf
+ libc.src.math.acoshf
+ libc.src.math.asinf
+ libc.src.math.asinhf
+ libc.src.math.atanf
+ libc.src.math.atanhf
+ libc.src.math.copysign
+ libc.src.math.copysignf
+ libc.src.math.copysignl
+ libc.src.math.ceil
+ libc.src.math.ceilf
+ libc.src.math.ceill
+ #libc.src.math.cos FIXME
+ libc.src.math.coshf
+ libc.src.math.cosf
+ libc.src.math.erff
+ libc.src.math.exp
+ libc.src.math.expf
+ libc.src.math.exp10
+ libc.src.math.exp10f
+ libc.src.math.exp2
+ libc.src.math.exp2f
+ libc.src.math.expm1f
+ libc.src.math.fabs
+ libc.src.math.fabsf
+ libc.src.math.fabsl
+ libc.src.math.fdim
+ libc.src.math.fdimf
+ libc.src.math.fdiml
+ libc.src.math.floor
+ libc.src.math.floorf
+ libc.src.math.floorl
+ libc.src.math.fma
+ libc.src.math.fmaf
+ libc.src.math.fmin
+ libc.src.math.fminf
+ libc.src.math.fminl
+ libc.src.math.fmax
+ libc.src.math.fmaxf
+ libc.src.math.fmaxl
+ libc.src.math.fmod
+ libc.src.math.fmodf
+ libc.src.math.frexp
+ libc.src.math.frexpf
+ libc.src.math.frexpl
+ libc.src.math.hypot
+ libc.src.math.hypotf
+ libc.src.math.ilogb
+ libc.src.math.ilogbf
+ libc.src.math.ilogbl
+ libc.src.math.ldexp
+ libc.src.math.ldexpf
+ libc.src.math.ldexpl
+ libc.src.math.llrint
+ libc.src.math.llrintf
+ libc.src.math.llrintl
+ libc.src.math.llround
+ libc.src.math.llroundf
+ libc.src.math.llroundl
+ libc.src.math.log10
+ libc.src.math.log10f
+ libc.src.math.log1p
+ libc.src.math.log1pf
+ libc.src.math.log2
+ libc.src.math.log2f
+ libc.src.math.log
+ libc.src.math.logf
+ libc.src.math.logb
+ libc.src.math.logbf
+ libc.src.math.logbl
+ libc.src.math.lrint
+ libc.src.math.lrintf
+ libc.src.math.lrintl
+ libc.src.math.lround
+ libc.src.math.lroundf
+ libc.src.math.lroundl
+ libc.src.math.modf
+ libc.src.math.modff
+ libc.src.math.modfl
+ libc.src.math.nearbyint
+ libc.src.math.nearbyintf
+ libc.src.math.nearbyintl
+ libc.src.math.nextafter
+ libc.src.math.nextafterf
+ libc.src.math.nextafterl
+ libc.src.math.remainderf
+ libc.src.math.remainder
+ libc.src.math.remainderl
+ libc.src.math.remquof
+ libc.src.math.remquo
+ libc.src.math.remquol
+ libc.src.math.rint
+ libc.src.math.rintf
+ libc.src.math.rintl
+ libc.src.math.round
+ libc.src.math.roundf
+ libc.src.math.roundl
+ libc.src.math.scalbn
+ libc.src.math.scalbnf
+ libc.src.math.scalbnl
+ #libc.src.math.sin FIXME
+ libc.src.math.sincosf
+ libc.src.math.sinhf
+ libc.src.math.sinf
+ libc.src.math.sqrt
+ libc.src.math.sqrtf
+ libc.src.math.sqrtl
+ #libc.src.math.tan FIXME
+ libc.src.math.tanf
+ libc.src.math.tanhf
+ libc.src.math.trunc
+ libc.src.math.truncf
+ libc.src.math.truncl
+)
+
+if(LLVM_LIBC_FULL_BUILD)
+ list(APPEND TARGET_LIBC_ENTRYPOINTS
+ # assert.h entrypoints
+ libc.src.assert.__assert_fail
+
+ # dirent.h entrypoints
+ libc.src.dirent.closedir
+ libc.src.dirent.dirfd
+ libc.src.dirent.opendir
+ libc.src.dirent.readdir
+
+ # network.h entrypoints
+ libc.src.network.htonl
+ libc.src.network.htons
+ libc.src.network.ntohl
+ libc.src.network.ntohs
+
+ # pthread.h entrypoints
+ libc.src.pthread.pthread_atfork
+ libc.src.pthread.pthread_attr_destroy
+ libc.src.pthread.pthread_attr_init
+ libc.src.pthread.pthread_attr_getdetachstate
+ libc.src.pthread.pthread_attr_getguardsize
+ libc.src.pthread.pthread_attr_getstack
+ libc.src.pthread.pthread_attr_getstacksize
+ libc.src.pthread.pthread_attr_setdetachstate
+ libc.src.pthread.pthread_attr_setguardsize
+ libc.src.pthread.pthread_attr_setstack
+ libc.src.pthread.pthread_attr_setstacksize
+ libc.src.pthread.pthread_create
+ libc.src.pthread.pthread_detach
+ libc.src.pthread.pthread_equal
+ libc.src.pthread.pthread_exit
+ libc.src.pthread.pthread_getname_np
+ libc.src.pthread.pthread_getspecific
+ libc.src.pthread.pthread_join
+ libc.src.pthread.pthread_key_create
+ libc.src.pthread.pthread_key_delete
+ libc.src.pthread.pthread_self
+ libc.src.pthread.pthread_setname_np
+ libc.src.pthread.pthread_mutex_destroy
+ libc.src.pthread.pthread_mutex_init
+ libc.src.pthread.pthread_mutex_lock
+ libc.src.pthread.pthread_mutex_unlock
+ libc.src.pthread.pthread_mutexattr_destroy
+ libc.src.pthread.pthread_mutexattr_init
+ libc.src.pthread.pthread_mutexattr_getpshared
+ libc.src.pthread.pthread_mutexattr_getrobust
+ libc.src.pthread.pthread_mutexattr_gettype
+ libc.src.pthread.pthread_mutexattr_setpshared
+ libc.src.pthread.pthread_mutexattr_setrobust
+ libc.src.pthread.pthread_mutexattr_settype
+ libc.src.pthread.pthread_once
+ libc.src.pthread.pthread_setspecific
+
+ # sched.h entrypoints
+ libc.src.sched.__sched_getcpucount
+
+ # setjmp.h entrypoints
+ libc.src.setjmp.longjmp
+ libc.src.setjmp.setjmp
+
+ # stdio.h entrypoints
+ libc.src.stdio.clearerr
+ libc.src.stdio.clearerr_unlocked
+ libc.src.stdio.fclose
+ libc.src.stdio.flockfile
+ libc.src.stdio.feof
+ libc.src.stdio.feof_unlocked
+ libc.src.stdio.ferror
+ libc.src.stdio.ferror_unlocked
+ libc.src.stdio.fgetc
+ libc.src.stdio.fgetc_unlocked
+ libc.src.stdio.fgets
+ libc.src.stdio.fflush
+ libc.src.stdio.fopen
+ libc.src.stdio.fputc
+ libc.src.stdio.fputs
+ libc.src.stdio.fopencookie
+ libc.src.stdio.fread
+ libc.src.stdio.fread_unlocked
+ libc.src.stdio.fseek
+ libc.src.stdio.ftell
+ libc.src.stdio.funlockfile
+ libc.src.stdio.fwrite
+ libc.src.stdio.fwrite_unlocked
+ libc.src.stdio.getc
+ libc.src.stdio.getc_unlocked
+ libc.src.stdio.getchar
+ libc.src.stdio.getchar_unlocked
+ libc.src.stdio.sscanf
+ libc.src.stdio.scanf
+ libc.src.stdio.fscanf
+ libc.src.stdio.putc
+ libc.src.stdio.putchar
+ libc.src.stdio.puts
+ libc.src.stdio.setbuf
+ libc.src.stdio.setvbuf
+ libc.src.stdio.stderr
+ libc.src.stdio.stdin
+ libc.src.stdio.stdout
+ libc.src.stdio.ungetc
+
+ # stdlib.h entrypoints
+ libc.src.stdlib._Exit
+ libc.src.stdlib.abort
+ libc.src.stdlib.atexit
+ libc.src.stdlib.exit
+ libc.src.stdlib.getenv
+
+ # signal.h entrypoints
+ libc.src.signal.raise
+ libc.src.signal.kill
+ libc.src.signal.sigaction
+ libc.src.signal.sigaltstack
+ libc.src.signal.sigdelset
+ libc.src.signal.sigaddset
+ libc.src.signal.sigemptyset
+ libc.src.signal.sigprocmask
+ libc.src.signal.sigfillset
+ libc.src.signal.signal
+
+ # spawn.h entrypoints
+ libc.src.spawn.posix_spawn
+ libc.src.spawn.posix_spawn_file_actions_addclose
+ libc.src.spawn.posix_spawn_file_actions_adddup2
+ libc.src.spawn.posix_spawn_file_actions_addopen
+ libc.src.spawn.posix_spawn_file_actions_destroy
+ libc.src.spawn.posix_spawn_file_actions_init
+
+ # threads.h entrypoints
+ libc.src.threads.call_once
+ libc.src.threads.cnd_broadcast
+ libc.src.threads.cnd_destroy
+ libc.src.threads.cnd_init
+ libc.src.threads.cnd_signal
+ libc.src.threads.cnd_wait
+ libc.src.threads.mtx_destroy
+ libc.src.threads.mtx_init
+ libc.src.threads.mtx_lock
+ libc.src.threads.mtx_unlock
+ libc.src.threads.thrd_create
+ libc.src.threads.thrd_current
+ libc.src.threads.thrd_detach
+ libc.src.threads.thrd_equal
+ libc.src.threads.thrd_exit
+ libc.src.threads.thrd_join
+ libc.src.threads.tss_create
+ libc.src.threads.tss_delete
+ libc.src.threads.tss_get
+ libc.src.threads.tss_set
+
+ # time.h entrypoints
+ libc.src.time.asctime
+ libc.src.time.asctime_r
+ libc.src.time.clock_gettime
+ libc.src.time.clock
+ libc.src.time.difftime
+ libc.src.time.gettimeofday
+ libc.src.time.gmtime
+ libc.src.time.gmtime_r
+ libc.src.time.mktime
+ libc.src.time.nanosleep
+ libc.src.time.time
+
+ # unistd.h entrypoints
+ libc.src.unistd.environ
+ libc.src.unistd.execv
+ libc.src.unistd.fork
+ libc.src.unistd.__llvm_libc_syscall
+ libc.src.unistd.getopt
+ libc.src.unistd.optarg
+ libc.src.unistd.optind
+ libc.src.unistd.optopt
+ libc.src.unistd.opterr
+ libc.src.unistd.swab
+
+ # sys/select.h entrypoints
+ libc.src.sys.select.select
+ )
+endif()
+
+set(TARGET_LLVMLIBC_ENTRYPOINTS
+ ${TARGET_LIBC_ENTRYPOINTS}
+ ${TARGET_LIBM_ENTRYPOINTS}
+)
diff --git a/libc/config/linux/hexagon/headers.txt b/libc/config/linux/hexagon/headers.txt
new file mode 100644
index 00000000000000..aaa75a9dd08cbd
--- /dev/null
+++ b/libc/config/linux/hexagon/headers.txt
@@ -0,0 +1,41 @@
+set(TARGET_PUBLIC_HEADERS
+ libc.include.assert
+ libc.include.ctype
+ libc.include.dirent
+ libc.include.errno
+ libc.include.fcntl
+ libc.include.fenv
+ libc.include.inttypes
+ libc.include.math
+ libc.include.pthread
+ libc.include.sched
+ libc.include.signal
+ libc.include.spawn
+ libc.include.setjmp
+ libc.include.stdio
+ libc.include.stdlib
+ libc.include...
[truncated]
|
You can test this locally with the following command:git-clang-format --diff a0a41d106dc932fa39c40562fc0d6f05fb8f5119 1343ea126775d77ad97223b2b86aae0dab6c8ac8 -- libc/src/__support/OSUtil/linux/hexagon/syscall.h libc/src/setjmp/hexagon/longjmp.cpp libc/src/setjmp/hexagon/setjmp.cpp libc/startup/linux/hexagon/start.cpp libc/config/linux/app.h libc/include/llvm-libc-macros/linux/signal-macros.h libc/include/llvm-libc-types/fenv_t.h libc/include/llvm-libc-types/jmp_buf.h libc/include/llvm-libc-types/wint_t.h libc/src/__support/OSUtil/linux/syscall.h libc/src/__support/RPC/rpc_util.h libc/src/__support/integer_utils.h libc/src/__support/macros/properties/architectures.h libc/src/__support/macros/properties/float.h libc/src/__support/threads/linux/thread.cpp libc/src/__support/threads/thread.h libc/src/string/memory_utils/inline_bcmp.h libc/src/string/memory_utils/inline_memcmp.h libc/src/string/memory_utils/inline_memcpy.h libc/src/string/memory_utils/inline_memmove.h libc/src/string/memory_utils/inline_memset.h libc/test/UnitTest/LibcDeathTestExecutors.cppView the diff from clang-format here.diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h
index 8585dcdefaa..99553f7e80a 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -23,7 +23,8 @@
(defined(LIBC_TARGET_OS_IS_MACOS) && \
defined(LIBC_TARGET_ARCH_IS_AARCH64)) || \
defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_NVPTX) || \
- defined(LIBC_TARGET_ARCH_IS_AMDGPU) || defined(LIBC_TARGET_ARCH_IS_HEXAGON)
+ defined(LIBC_TARGET_ARCH_IS_AMDGPU) || \
+ defined(LIBC_TARGET_ARCH_IS_HEXAGON)
#define LONG_DOUBLE_IS_DOUBLE
#endif
diff --git a/libc/src/setjmp/hexagon/longjmp.cpp b/libc/src/setjmp/hexagon/longjmp.cpp
index ee334553155..a30d5dc865b 100644
--- a/libc/src/setjmp/hexagon/longjmp.cpp
+++ b/libc/src/setjmp/hexagon/longjmp.cpp
@@ -21,14 +21,14 @@
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
- LOAD(r17:16, buf->__regs[0]);
- LOAD(r19:18, buf->__regs[2]);
- LOAD(r21:20, buf->__regs[4]);
- LOAD(r23:22, buf->__regs[6]);
- LOAD(r25:24, buf->__regs[8]);
- LOAD(r27:26, buf->__regs[10]);
- LOAD(r29:28, buf->__regs[12]);
- LOAD(r31:30, buf->__regs[14]);
+ LOAD(r17 : 16, buf->__regs[0]);
+ LOAD(r19 : 18, buf->__regs[2]);
+ LOAD(r21 : 20, buf->__regs[4]);
+ LOAD(r23 : 22, buf->__regs[6]);
+ LOAD(r25 : 24, buf->__regs[8]);
+ LOAD(r27 : 26, buf->__regs[10]);
+ LOAD(r29 : 28, buf->__regs[12]);
+ LOAD(r31 : 30, buf->__regs[14]);
val = val == 0 ? 1 : val;
LIBC_INLINE_ASM("r0 = %0\n\t" : : "r"(val) :);
diff --git a/libc/src/setjmp/hexagon/setjmp.cpp b/libc/src/setjmp/hexagon/setjmp.cpp
index 5c936f29f7e..3dfb7e76b74 100644
--- a/libc/src/setjmp/hexagon/setjmp.cpp
+++ b/libc/src/setjmp/hexagon/setjmp.cpp
@@ -21,14 +21,14 @@
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
- STORE(r17:16, buf->__regs[0]);
- STORE(r19:18, buf->__regs[2]);
- STORE(r21:20, buf->__regs[4]);
- STORE(r23:22, buf->__regs[6]);
- STORE(r25:24, buf->__regs[8]);
- STORE(r27:26, buf->__regs[10]);
- STORE(r29:28, buf->__regs[12]);
- STORE(r31:30, buf->__regs[14]);
+ STORE(r17 : 16, buf->__regs[0]);
+ STORE(r19 : 18, buf->__regs[2]);
+ STORE(r21 : 20, buf->__regs[4]);
+ STORE(r23 : 22, buf->__regs[6]);
+ STORE(r25 : 24, buf->__regs[8]);
+ STORE(r27 : 26, buf->__regs[10]);
+ STORE(r29 : 28, buf->__regs[12]);
+ STORE(r31 : 30, buf->__regs[14]);
return 0;
}
|
| typedef struct { | ||
| unsigned int __fpscr; | ||
| } fenv_t; | ||
| #elif defined(__riscv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge with __riscv instead.
|
Closing: this PR is too far out of date to be useful. Hopefully it will get revisited in the not-too-distant future. |
|
FWIW, I spoke with @apazos at the '24 US LLVM Dev conf about this, which led to the email about qemu-system support. We're going to be revisiting the buildbots in H1'25; I'm looking to move most of our CI to cross compilation+testing in qemu. We might not need qemu-system support just yet. At that point, wiring up more buildbots for additional architectures should become more straightforward for us. |
Ok, gotcha. Buildbots are not a major factor in this particular PR succeeding or failing IMO. This PR was very much incomplete - missing some significant work in crt0. Compiler was generating a preamble that couldn't coexist with the inline asm in Based on some discussions I've had lately, I suspect someone will resurrect it Sometime Soon.
Our focus on Regardless of buildbots - linux userspace QEMU is ideal for running tests like the ones defined in llvm-test-suite. We could also use it to run the libc++/libc++abi test suites. Or maybe we already are testing some of those w/QEMU user? But as far as libc tests - I'm not quite sure whether QEMU's linux-userspace is the right thing to use. Making each architecture port of the libc robust enough to be able to interact with any host architecture's kernel and still pass comprehensive libc tests - this might be a higher bar than desired. But there's bound to be a subset of tests that still make sense. |
this PR not in a useful state for review