[libc] Enable creat, fsync, open, openat, read and write for aarch64.

This commit is contained in:
Siva Chandra 2022-01-28 11:41:26 -08:00
parent 86797fdb6f
commit 0e91c48df0
3 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,11 @@ set(TARGET_LIBC_ENTRYPOINTS
# errno.h entrypoints
libc.src.errno.__errno_location
# fcntl.h entrypoints
libc.src.fcntl.creat
libc.src.fcntl.open
libc.src.fcntl.openat
# string.h entrypoints
libc.src.string.bcmp
libc.src.string.bzero
@ -75,6 +80,12 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdlib.strtoll
libc.src.stdlib.strtoul
libc.src.stdlib.strtoull
# unistd.h entrypoints
libc.src.unistd.close
libc.src.unistd.fsync
libc.src.unistd.read
libc.src.unistd.write
)
set(TARGET_LIBM_ENTRYPOINTS

View File

@ -18,8 +18,14 @@
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) {
#ifdef SYS_open
int fd = __llvm_libc::syscall(SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC,
mode_flags);
#else
int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, path,
O_CREAT | O_WRONLY | O_TRUNC, mode_flags);
#endif
if (fd > 0)
return fd;

View File

@ -29,7 +29,11 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) {
va_end(varargs);
}
#ifdef SYS_open
int fd = __llvm_libc::syscall(SYS_open, path, flags, mode_flags);
#else
int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, path, flags, mode_flags);
#endif
if (fd > 0)
return fd;