diff options
author | Siva Chandra <sivachandra@google.com> | 2022-01-31 22:17:44 -0800 |
---|---|---|
committer | Siva Chandra <sivachandra@google.com> | 2022-02-01 00:26:36 -0800 |
commit | be7c865af11c2f0a9fa639f94cc1e607d0f7a0b5 (patch) | |
tree | 375adcb13e2c54408b8793025ecf7ed77602cd46 /libc | |
parent | [Attributor][FIX] Relax assertion in IRPosition::verify (diff) | |
download | llvm-project-be7c865af11c2f0a9fa639f94cc1e607d0f7a0b5.tar.gz llvm-project-be7c865af11c2f0a9fa639f94cc1e607d0f7a0b5.tar.bz2 llvm-project-be7c865af11c2f0a9fa639f94cc1e607d0f7a0b5.zip |
[libc] Add a few missing deps, includes, and fix a few typos.
This allows us to enable rmdir, mkdir, mkdirat, unlink and unlinkat for
aarch64.
Diffstat (limited to 'libc')
-rw-r--r-- | libc/config/linux/aarch64/entrypoints.txt | 7 | ||||
-rw-r--r-- | libc/src/sys/stat/linux/CMakeLists.txt | 1 | ||||
-rw-r--r-- | libc/src/sys/stat/linux/mkdir.cpp | 1 | ||||
-rw-r--r-- | libc/src/unistd/linux/CMakeLists.txt | 3 | ||||
-rw-r--r-- | libc/src/unistd/linux/rmdir.cpp | 3 | ||||
-rw-r--r-- | libc/src/unistd/linux/unlink.cpp | 1 | ||||
-rw-r--r-- | libc/src/unistd/linux/unlinkat.cpp | 1 | ||||
-rw-r--r-- | libc/test/src/fcntl/openat_test.cpp | 1 | ||||
-rw-r--r-- | libc/test/src/sys/stat/mkdirat_test.cpp | 2 |
9 files changed, 18 insertions, 2 deletions
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index fe43f2e40a37..f73556afc017 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -81,10 +81,17 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.stdlib.strtoul libc.src.stdlib.strtoull + # sys/stat.h entrypoints + libc.src.sys.stat.mkdir + libc.src.sys.stat.mkdirat + # unistd.h entrypoints libc.src.unistd.close libc.src.unistd.fsync libc.src.unistd.read + libc.src.unistd.rmdir + libc.src.unistd.unlink + libc.src.unistd.unlinkat libc.src.unistd.write ) diff --git a/libc/src/sys/stat/linux/CMakeLists.txt b/libc/src/sys/stat/linux/CMakeLists.txt index 5a818837ae15..bf92d5f4b88c 100644 --- a/libc/src/sys/stat/linux/CMakeLists.txt +++ b/libc/src/sys/stat/linux/CMakeLists.txt @@ -5,6 +5,7 @@ add_entrypoint_object( HDRS ../mkdir.h DEPENDS + libc.include.fcntl libc.include.sys_stat libc.include.sys_syscall libc.src.__support.OSUtil.osutil diff --git a/libc/src/sys/stat/linux/mkdir.cpp b/libc/src/sys/stat/linux/mkdir.cpp index 3477e1a5cbe8..135c9b930cc7 100644 --- a/libc/src/sys/stat/linux/mkdir.cpp +++ b/libc/src/sys/stat/linux/mkdir.cpp @@ -12,6 +12,7 @@ #include "src/__support/common.h" #include <errno.h> +#include <fcntl.h> #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt index c08bd1847768..30e073a1cb1b 100644 --- a/libc/src/unistd/linux/CMakeLists.txt +++ b/libc/src/unistd/linux/CMakeLists.txt @@ -44,6 +44,7 @@ add_entrypoint_object( HDRS ../rmdir.h DEPENDS + libc.include.fcntl libc.include.unistd libc.include.sys_syscall libc.src.__support.OSUtil.osutil @@ -57,6 +58,7 @@ add_entrypoint_object( HDRS ../unlink.h DEPENDS + libc.include.fcntl libc.include.unistd libc.include.sys_syscall libc.src.__support.OSUtil.osutil @@ -70,6 +72,7 @@ add_entrypoint_object( HDRS ../unlinkat.h DEPENDS + libc.include.fcntl libc.include.unistd libc.include.sys_syscall libc.src.__support.OSUtil.osutil diff --git a/libc/src/unistd/linux/rmdir.cpp b/libc/src/unistd/linux/rmdir.cpp index 220330aecde5..8bc180550021 100644 --- a/libc/src/unistd/linux/rmdir.cpp +++ b/libc/src/unistd/linux/rmdir.cpp @@ -12,6 +12,7 @@ #include "src/__support/common.h" #include <errno.h> +#include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. namespace __llvm_libc { @@ -20,7 +21,7 @@ LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) { #ifdef SYS_rmdir long ret = __llvm_libc::syscall(SYS_rmdir, path); #elif defined(SYS_unlinkat) - long ret = __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, path, 0); + long ret = __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); #else #error "rmdir and unlinkat syscalls not available." #endif diff --git a/libc/src/unistd/linux/unlink.cpp b/libc/src/unistd/linux/unlink.cpp index f02f745e79f5..386a84e7679e 100644 --- a/libc/src/unistd/linux/unlink.cpp +++ b/libc/src/unistd/linux/unlink.cpp @@ -12,6 +12,7 @@ #include "src/__support/common.h" #include <errno.h> +#include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. namespace __llvm_libc { diff --git a/libc/src/unistd/linux/unlinkat.cpp b/libc/src/unistd/linux/unlinkat.cpp index 54d3c103bd7c..dcfea888453f 100644 --- a/libc/src/unistd/linux/unlinkat.cpp +++ b/libc/src/unistd/linux/unlinkat.cpp @@ -12,6 +12,7 @@ #include "src/__support/common.h" #include <errno.h> +#include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. namespace __llvm_libc { diff --git a/libc/test/src/fcntl/openat_test.cpp b/libc/test/src/fcntl/openat_test.cpp index b4c05f41ccaa..9a86728b1726 100644 --- a/libc/test/src/fcntl/openat_test.cpp +++ b/libc/test/src/fcntl/openat_test.cpp @@ -15,6 +15,7 @@ #include "utils/testutils/FDReader.h" #include <errno.h> +#include <fcntl.h> TEST(LlvmLibcUniStd, OpenAndReadTest) { using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; diff --git a/libc/test/src/sys/stat/mkdirat_test.cpp b/libc/test/src/sys/stat/mkdirat_test.cpp index 4a45fe2ffb88..dae54c51280c 100644 --- a/libc/test/src/sys/stat/mkdirat_test.cpp +++ b/libc/test/src/sys/stat/mkdirat_test.cpp @@ -17,7 +17,7 @@ TEST(LlvmLibcMkdiratTest, CreateAndRemove) { using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; - constexpr const char *TEST_DIR = "testdata/rmdir.testdir"; + constexpr const char *TEST_DIR = "testdata/mkdirat.testdir"; ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0)); ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0)); } |