diff options
author | Siva Chandra Reddy <sivachandra@google.com> | 2021-12-22 18:17:50 +0000 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@google.com> | 2021-12-22 21:48:57 +0000 |
commit | 3cc2161c897ca6c9f1ff09fbc610a6ae40b3b566 (patch) | |
tree | 96070a16d98fdc4d76882af618d2169a195f4de1 | |
parent | edf8e3ea5ee74f7bf86651b6caa29e456e3119cd (diff) | |
download | llvm-3cc2161c897ca6c9f1ff09fbc610a6ae40b3b566.zip llvm-3cc2161c897ca6c9f1ff09fbc610a6ae40b3b566.tar.gz llvm-3cc2161c897ca6c9f1ff09fbc610a6ae40b3b566.tar.bz2 |
[libc] Move the x86_64 syscall functions to OSUtil.
Reviewed By: michaelrj, lntue
Differential Revision: https://reviews.llvm.org/D116177
38 files changed, 106 insertions, 88 deletions
diff --git a/libc/config/linux/CMakeLists.txt b/libc/config/linux/CMakeLists.txt index e3a0018..bc42557 100644 --- a/libc/config/linux/CMakeLists.txt +++ b/libc/config/linux/CMakeLists.txt @@ -1,15 +1,3 @@ -add_gen_header( - linux_syscall_h - DEF_FILE syscall.h.def - GEN_HDR syscall.h - PARAMS - inline_syscalls=${LIBC_TARGET_ARCHITECTURE}/syscall.h.inc - DATA_FILES - ${LIBC_TARGET_ARCHITECTURE}/syscall.h.inc - DEPENDS - libc.src.__support.common -) - add_header( app_h HDR diff --git a/libc/loader/linux/x86_64/CMakeLists.txt b/libc/loader/linux/x86_64/CMakeLists.txt index ceaa94e..75b8a23 100644 --- a/libc/loader/linux/x86_64/CMakeLists.txt +++ b/libc/loader/linux/x86_64/CMakeLists.txt @@ -3,9 +3,9 @@ add_loader_object( SRC start.cpp DEPENDS - libc.config.linux.linux_syscall_h libc.config.linux.app_h libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.string.memcpy libc.src.sys.mman.mmap COMPILE_OPTIONS diff --git a/libc/loader/linux/x86_64/start.cpp b/libc/loader/linux/x86_64/start.cpp index 320fda9..55ae003 100644 --- a/libc/loader/linux/x86_64/start.cpp +++ b/libc/loader/linux/x86_64/start.cpp @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "config/linux/app.h" -#include "config/linux/syscall.h" #include "include/sys/mman.h" #include "include/sys/syscall.h" +#include "src/__support/OSUtil/syscall.h" #include "src/string/memcpy.h" #include "src/sys/mman/mmap.h" diff --git a/libc/src/__support/OSUtil/CMakeLists.txt b/libc/src/__support/OSUtil/CMakeLists.txt index b0f7ac8..028a9c0 100644 --- a/libc/src/__support/OSUtil/CMakeLists.txt +++ b/libc/src/__support/OSUtil/CMakeLists.txt @@ -5,6 +5,7 @@ add_header_library( HDRS io.h quick_exit.h + syscall.h DEPENDS libc.src.__support.OSUtil.linux.linux_util ) diff --git a/libc/src/__support/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt index 3828614..4b0f5d7 100644 --- a/libc/src/__support/OSUtil/linux/CMakeLists.txt +++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt @@ -1,10 +1,12 @@ +add_subdirectory(x86_64) + add_header_library( linux_util HDRS io.h quick_exit.h + syscall.h DEPENDS - libc.config.linux.linux_syscall_h - libc.include.sys_syscall - libc.src.string.string_utils + .x86_64.linux_x86_64_util + libc.src.__support.common ) diff --git a/libc/src/__support/OSUtil/linux/io.h b/libc/src/__support/OSUtil/linux/io.h index 5aaa544..71830476 100644 --- a/libc/src/__support/OSUtil/linux/io.h +++ b/libc/src/__support/OSUtil/linux/io.h @@ -9,9 +9,9 @@ #ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_IO_H #define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_IO_H -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. #include "src/string/string_utils.h" +#include "syscall.h" // For internal syscall function. namespace __llvm_libc { diff --git a/libc/src/__support/OSUtil/linux/quick_exit.h b/libc/src/__support/OSUtil/linux/quick_exit.h index 932959d..eb9d86f 100644 --- a/libc/src/__support/OSUtil/linux/quick_exit.h +++ b/libc/src/__support/OSUtil/linux/quick_exit.h @@ -9,8 +9,8 @@ #ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H #define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "syscall.h" // For internal syscall function. namespace __llvm_libc { diff --git a/libc/src/__support/OSUtil/linux/syscall.h b/libc/src/__support/OSUtil/linux/syscall.h new file mode 100644 index 0000000..754883e --- /dev/null +++ b/libc/src/__support/OSUtil/linux/syscall.h @@ -0,0 +1,18 @@ +//===----------------------- Linux syscalls ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H +#define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H + +#include "src/__support/architectures.h" + +#ifdef LLVM_LIBC_ARCH_X86_64 +#include "x86_64/syscall.h" +#endif + +#endif // LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_SYSCALL_H diff --git a/libc/src/__support/OSUtil/linux/x86_64/CMakeLists.txt b/libc/src/__support/OSUtil/linux/x86_64/CMakeLists.txt new file mode 100644 index 0000000..a7f2d74e6 --- /dev/null +++ b/libc/src/__support/OSUtil/linux/x86_64/CMakeLists.txt @@ -0,0 +1,7 @@ +add_header_library( + linux_x86_64_util + HDRS + syscall.h + DEPENDS + libc.src.__support.common +) diff --git a/libc/config/linux/x86_64/syscall.h.inc b/libc/src/__support/OSUtil/linux/x86_64/syscall.h index ee3b5e5..77d1398 100644 --- a/libc/config/linux/x86_64/syscall.h.inc +++ b/libc/src/__support/OSUtil/linux/x86_64/syscall.h @@ -1,4 +1,4 @@ -//===------------ inline implementation of x86_64 syscalls ----------------===// +//===---------- inline implementation of x86_64 syscalls ----------* C++ *-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -%%begin() +#ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_X86_64_SYSCALL_H +#define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_X86_64_SYSCALL_H #include "src/__support/common.h" @@ -100,7 +101,8 @@ __attribute__((always_inline)) inline long syscall(long __number, Ts... ts) { return syscall(__number, (long)ts...); } - #undef SYSCALL_CLOBBER_LIST } // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_X86_64_SYSCALL_H diff --git a/libc/config/linux/syscall.h.def b/libc/src/__support/OSUtil/syscall.h index 0daceaf..b113727 100644 --- a/libc/config/linux/syscall.h.def +++ b/libc/src/__support/OSUtil/syscall.h @@ -6,9 +6,11 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_CONFIG_LINUX_SYSCALL_H -#define LLVM_LIBC_CONFIG_LINUX_SYSCALL_H +#ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_SYSCALL_H +#define LLVM_LIBC_SRC_SUPPORT_OSUTIL_SYSCALL_H -%%include_file(${inline_syscalls}) +#ifdef __unix__ +#include "linux/syscall.h" +#endif -#endif // LLVM_LIBC_CONFIG_LINUX_SYSCALL_H +#endif // LLVM_LIBC_SRC_SUPPORT_OSUTIL_SYSCALL_H diff --git a/libc/src/assert/CMakeLists.txt b/libc/src/assert/CMakeLists.txt index 36123cc..7f82017 100644 --- a/libc/src/assert/CMakeLists.txt +++ b/libc/src/assert/CMakeLists.txt @@ -8,7 +8,7 @@ add_entrypoint_object( DEPENDS # These two dependencies are temporary and should be replaced by fprintf # later. - libc.config.linux.linux_syscall_h + libc.src.__support.OSUtil.osutil libc.include.sys_syscall libc.src.stdlib.abort ) diff --git a/libc/src/assert/__assert_fail.cpp b/libc/src/assert/__assert_fail.cpp index 0fe2ca6..93c176a 100644 --- a/libc/src/assert/__assert_fail.cpp +++ b/libc/src/assert/__assert_fail.cpp @@ -10,8 +10,8 @@ #include "src/stdlib/abort.h" // These includes are temporary. -#include "config/linux/syscall.h" // For internal syscall function. #include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. namespace __llvm_libc { diff --git a/libc/src/signal/linux/CMakeLists.txt b/libc/src/signal/linux/CMakeLists.txt index fc4a7aa..419146f5 100644 --- a/libc/src/signal/linux/CMakeLists.txt +++ b/libc/src/signal/linux/CMakeLists.txt @@ -7,9 +7,9 @@ add_entrypoint_object( signal.h ../raise.h DEPENDS - libc.config.linux.linux_syscall_h libc.include.signal libc.include.sys_syscall + libc.src.__support.OSUtil.osutil ) add_object_library( @@ -25,8 +25,8 @@ add_object_library( # asan creates asan.module_ctor which uses stack space, causing warnings. -fno-sanitize=address DEPENDS - libc.config.linux.linux_syscall_h libc.include.sys_syscall + libc.src.__support.OSUtil.osutil ) add_entrypoint_object( @@ -38,9 +38,9 @@ add_entrypoint_object( ../sigaction.h DEPENDS .__restore - libc.config.linux.linux_syscall_h libc.include.signal libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location ) @@ -52,9 +52,9 @@ add_entrypoint_object( signal.h ../sigprocmask.h DEPENDS - libc.config.linux.linux_syscall_h libc.include.signal libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location ) diff --git a/libc/src/signal/linux/__restore.cpp b/libc/src/signal/linux/__restore.cpp index 8ce848f..c648ddb 100644 --- a/libc/src/signal/linux/__restore.cpp +++ b/libc/src/signal/linux/__restore.cpp @@ -10,8 +10,8 @@ // strongly control the options this file is compiled with. __restore_rt cannot // make any stack allocations so we must ensure this. -#include "config/linux/syscall.h" #include "include/sys/syscall.h" +#include "src/__support/OSUtil/syscall.h" namespace __llvm_libc { diff --git a/libc/src/signal/linux/signal.h b/libc/src/signal/linux/signal.h index a59a56c..fd312d7 100644 --- a/libc/src/signal/linux/signal.h +++ b/libc/src/signal/linux/signal.h @@ -9,8 +9,8 @@ #ifndef LLVM_LIBC_SRC_SIGNAL_LINUX_SIGNAL_H #define LLVM_LIBC_SRC_SIGNAL_LINUX_SIGNAL_H -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "include/signal.h" diff --git a/libc/src/stdlib/linux/CMakeLists.txt b/libc/src/stdlib/linux/CMakeLists.txt index 27e00a3..c5130c1 100644 --- a/libc/src/stdlib/linux/CMakeLists.txt +++ b/libc/src/stdlib/linux/CMakeLists.txt @@ -6,6 +6,6 @@ add_entrypoint_object( ../_Exit.h DEPENDS libc.include.sys_syscall - libc.config.linux.linux_syscall_h libc.include.stdlib + libc.src.__support.OSUtil.osutil ) diff --git a/libc/src/stdlib/linux/_Exit.cpp b/libc/src/stdlib/linux/_Exit.cpp index 7fdd60f..51b0a48 100644 --- a/libc/src/stdlib/linux/_Exit.cpp +++ b/libc/src/stdlib/linux/_Exit.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/stdlib/_Exit.h" diff --git a/libc/src/sys/mman/linux/CMakeLists.txt b/libc/src/sys/mman/linux/CMakeLists.txt index 7bf7c2f..949d965 100644 --- a/libc/src/sys/mman/linux/CMakeLists.txt +++ b/libc/src/sys/mman/linux/CMakeLists.txt @@ -5,9 +5,9 @@ add_entrypoint_object( HDRS ../mmap.h DEPENDS - libc.config.linux.linux_syscall_h libc.include.sys_mman libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location ) @@ -18,8 +18,8 @@ add_entrypoint_object( HDRS ../munmap.h DEPENDS - libc.config.linux.linux_syscall_h libc.include.sys_mman libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location ) diff --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp index 31e114a..0447ef1 100644 --- a/libc/src/sys/mman/linux/mmap.cpp +++ b/libc/src/sys/mman/linux/mmap.cpp @@ -8,8 +8,8 @@ #include "src/sys/mman/mmap.h" -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/errno/llvmlibc_errno.h" diff --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp index fd89773..7801a63 100644 --- a/libc/src/sys/mman/linux/munmap.cpp +++ b/libc/src/sys/mman/linux/munmap.cpp @@ -8,8 +8,8 @@ #include "src/sys/mman/munmap.h" -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/errno/llvmlibc_errno.h" diff --git a/libc/src/threads/linux/CMakeLists.txt b/libc/src/threads/linux/CMakeLists.txt index e9fc8d2..fcc3381 100644 --- a/libc/src/threads/linux/CMakeLists.txt +++ b/libc/src/threads/linux/CMakeLists.txt @@ -16,9 +16,9 @@ add_entrypoint_object( ../call_once.h DEPENDS .threads_utils - libc.config.linux.linux_syscall_h libc.include.sys_syscall libc.include.threads + libc.src.__support.OSUtil.osutil ) add_header_library( @@ -30,9 +30,9 @@ add_header_library( Thread.h DEPENDS .thread_start_args_h - libc.config.linux.linux_syscall_h libc.include.sys_syscall libc.include.threads + libc.src.__support.OSUtil.osutil ) add_entrypoint_object( @@ -43,11 +43,11 @@ add_entrypoint_object( ../thrd_create.h DEPENDS .threads_utils - libc.config.linux.linux_syscall_h libc.include.errno libc.include.sys_syscall libc.include.threads libc.src.__support.common + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location libc.src.sys.mman.mmap COMPILE_OPTIONS @@ -64,11 +64,11 @@ add_entrypoint_object( ../thrd_join.h DEPENDS .threads_utils - libc.config.linux.linux_syscall_h libc.include.sys_syscall libc.include.threads - libc.src.sys.mman.munmap libc.src.__support.common + libc.src.__support.OSUtil.osutil + libc.src.sys.mman.munmap ) add_entrypoint_object( diff --git a/libc/src/threads/linux/CndVar.h b/libc/src/threads/linux/CndVar.h index 5d9ced5..7e531c8 100644 --- a/libc/src/threads/linux/CndVar.h +++ b/libc/src/threads/linux/CndVar.h @@ -12,9 +12,9 @@ #include "Futex.h" #include "Mutex.h" -#include "config/linux/syscall.h" // For syscall functions. -#include "include/sys/syscall.h" // For syscall numbers. -#include "include/threads.h" // For values like thrd_success etc. +#include "include/sys/syscall.h" // For syscall numbers. +#include "include/threads.h" // For values like thrd_success etc. +#include "src/__support/OSUtil/syscall.h" // For syscall functions. #include <linux/futex.h> // For futex operations. #include <stdatomic.h> // For atomic operations diff --git a/libc/src/threads/linux/Mutex.h b/libc/src/threads/linux/Mutex.h index f6033c9..a7b06d4 100644 --- a/libc/src/threads/linux/Mutex.h +++ b/libc/src/threads/linux/Mutex.h @@ -11,9 +11,9 @@ #include "Futex.h" -#include "config/linux/syscall.h" // For syscall functions. -#include "include/sys/syscall.h" // For syscall numbers. -#include "include/threads.h" // For values like thrd_success etc. +#include "include/sys/syscall.h" // For syscall numbers. +#include "include/threads.h" // For values like thrd_success etc. +#include "src/__support/OSUtil/syscall.h" // For syscall functions. #include <linux/futex.h> // For futex operations. #include <stdatomic.h> diff --git a/libc/src/threads/linux/call_once.cpp b/libc/src/threads/linux/call_once.cpp index 1bcb46f..9b96646 100644 --- a/libc/src/threads/linux/call_once.cpp +++ b/libc/src/threads/linux/call_once.cpp @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "src/threads/call_once.h" -#include "config/linux/syscall.h" // For syscall functions. -#include "include/sys/syscall.h" // For syscall numbers. -#include "include/threads.h" // For call_once related type definition. +#include "include/sys/syscall.h" // For syscall numbers. +#include "include/threads.h" // For call_once related type definition. +#include "src/__support/OSUtil/syscall.h" // For syscall functions. #include "src/__support/common.h" #include "src/threads/linux/Futex.h" diff --git a/libc/src/threads/linux/thrd_create.cpp b/libc/src/threads/linux/thrd_create.cpp index f2464d4..5421c96 100644 --- a/libc/src/threads/linux/thrd_create.cpp +++ b/libc/src/threads/linux/thrd_create.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "src/threads/thrd_create.h" -#include "config/linux/syscall.h" // For syscall function. -#include "include/errno.h" // For E* error values. -#include "include/sys/mman.h" // For PROT_* and MAP_* definitions. -#include "include/sys/syscall.h" // For syscall numbers. -#include "include/threads.h" // For thrd_* type definitions. +#include "include/errno.h" // For E* error values. +#include "include/sys/mman.h" // For PROT_* and MAP_* definitions. +#include "include/sys/syscall.h" // For syscall numbers. +#include "include/threads.h" // For thrd_* type definitions. +#include "src/__support/OSUtil/syscall.h" // For syscall function. #include "src/__support/common.h" #include "src/errno/llvmlibc_errno.h" #include "src/sys/mman/mmap.h" diff --git a/libc/src/threads/linux/thrd_join.cpp b/libc/src/threads/linux/thrd_join.cpp index 3c77949..f55f5a3 100644 --- a/libc/src/threads/linux/thrd_join.cpp +++ b/libc/src/threads/linux/thrd_join.cpp @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "src/threads/thrd_join.h" -#include "config/linux/syscall.h" // For syscall function. -#include "include/sys/syscall.h" // For syscall numbers. -#include "include/threads.h" // For thrd_* type definitions. +#include "include/sys/syscall.h" // For syscall numbers. +#include "include/threads.h" // For thrd_* type definitions. +#include "src/__support/OSUtil/syscall.h" // For syscall function. #include "src/__support/common.h" #include "src/sys/mman/munmap.h" #include "src/threads/linux/Futex.h" diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt index bd2cba7..1c3fdf1 100644 --- a/libc/src/unistd/linux/CMakeLists.txt +++ b/libc/src/unistd/linux/CMakeLists.txt @@ -6,7 +6,7 @@ add_entrypoint_object( ../write.h DEPENDS libc.include.unistd - libc.config.linux.linux_syscall_h libc.include.sys_syscall + libc.src.__support.OSUtil.osutil libc.src.errno.__errno_location ) diff --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp index de0efb9..3554e30 100644 --- a/libc/src/unistd/linux/write.cpp +++ b/libc/src/unistd/linux/write.cpp @@ -8,8 +8,8 @@ #include "src/unistd/write.h" -#include "config/linux/syscall.h" // For internal syscall function. -#include "include/sys/syscall.h" // For syscall numbers. +#include "include/sys/syscall.h" // For syscall numbers. +#include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/errno/llvmlibc_errno.h" diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt index 3cf1f8d..850d693 100644 --- a/libc/test/CMakeLists.txt +++ b/libc/test/CMakeLists.txt @@ -18,6 +18,5 @@ if(NOT LLVM_LIBC_FULL_BUILD) return() endif() -add_subdirectory(config) add_subdirectory(integration) add_subdirectory(loader) diff --git a/libc/test/config/CMakeLists.txt b/libc/test/config/CMakeLists.txt deleted file mode 100644 index 52824d2..0000000 --- a/libc/test/config/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(${LIBC_TARGET_OS}) diff --git a/libc/test/config/linux/CMakeLists.txt b/libc/test/config/linux/CMakeLists.txt deleted file mode 100644 index b449a33..0000000 --- a/libc/test/config/linux/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_libc_testsuite(libc_linux_tests) - -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE}) - add_subdirectory(${LIBC_TARGET_ARCHITECTURE}) -endif() diff --git a/libc/test/config/linux/x86_64/CMakeLists.txt b/libc/test/config/linux/x86_64/CMakeLists.txt deleted file mode 100644 index 0436736..0000000 --- a/libc/test/config/linux/x86_64/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_libc_unittest( - libc_linux_x86_64_syscall_unittest - SUITE libc_linux_tests - SRCS syscall_test.cpp - DEPENDS - libc.config.linux.linux_syscall_h -) diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt index d2367ef..20d0e2d 100644 --- a/libc/test/src/__support/CMakeLists.txt +++ b/libc/test/src/__support/CMakeLists.txt @@ -48,3 +48,5 @@ add_custom_command(TARGET libc_str_to_float_comparison_test DEPENDS ${float_test_file} COMMENT "Test the strtof and strtod implementations against precomputed results." VERBATIM) + +add_subdirectory(OSUtil) diff --git a/libc/test/src/__support/OSUtil/CMakeLists.txt b/libc/test/src/__support/OSUtil/CMakeLists.txt new file mode 100644 index 0000000..494218b --- /dev/null +++ b/libc/test/src/__support/OSUtil/CMakeLists.txt @@ -0,0 +1,3 @@ +add_libc_testsuite(libc_osutil_tests) + +add_subdirectory(linux) diff --git a/libc/test/src/__support/OSUtil/linux/CMakeLists.txt b/libc/test/src/__support/OSUtil/linux/CMakeLists.txt new file mode 100644 index 0000000..7e2608e --- /dev/null +++ b/libc/test/src/__support/OSUtil/linux/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(x86_64) diff --git a/libc/test/src/__support/OSUtil/linux/x86_64/CMakeLists.txt b/libc/test/src/__support/OSUtil/linux/x86_64/CMakeLists.txt new file mode 100644 index 0000000..b6f57eb --- /dev/null +++ b/libc/test/src/__support/OSUtil/linux/x86_64/CMakeLists.txt @@ -0,0 +1,7 @@ +add_libc_unittest( + syscall_unittest + SUITE libc_osutil_tests + SRCS syscall_test.cpp + DEPENDS + libc.src.__support.OSUtil.osutil +) diff --git a/libc/test/config/linux/x86_64/syscall_test.cpp b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp index eb2205a..2f9816e 100644 --- a/libc/test/config/linux/x86_64/syscall_test.cpp +++ b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "config/linux/syscall.h" -#include "utils/UnitTest/Test.h" - #include "src/__support/CPP/Functional.h" +#include "src/__support/OSUtil/syscall.h" +#include "utils/UnitTest/Test.h" TEST(LlvmLibcX86_64_SyscallTest, APITest) { // We only do a signature test here. Actual functionality tests are |