diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 33dd8d06173b25..080ca2dc9e1161 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -17,6 +17,12 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.ctype.tolower libc.src.ctype.toupper + # dlfcn.h entrypoints + libc.src.dlfcn.dlclose + libc.src.dlfcn.dlerror + libc.src.dlfcn.dlopen + libc.src.dlfcn.dlsym + # errno.h entrypoints libc.src.errno.errno @@ -52,6 +58,7 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.string.mempcpy libc.src.string.memrchr libc.src.string.memset + libc.src.string.memset_explicit libc.src.string.rindex libc.src.string.stpcpy libc.src.string.stpncpy @@ -180,6 +187,9 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.stdlib.qsort_r libc.src.stdlib.rand libc.src.stdlib.srand + libc.src.stdlib.strfromd + libc.src.stdlib.strfromf + libc.src.stdlib.strfroml libc.src.stdlib.strtod libc.src.stdlib.strtof libc.src.stdlib.strtol @@ -197,6 +207,7 @@ set(TARGET_LIBC_ENTRYPOINTS # stdio.h entrypoints libc.src.stdio.fdopen + libc.src.stdio.fileno libc.src.stdio.fprintf libc.src.stdio.fscanf libc.src.stdio.printf @@ -211,6 +222,14 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.stdio.vsnprintf libc.src.stdio.vsprintf + # sys/epoll.h entrypoints + libc.src.sys.epoll.epoll_create + libc.src.sys.epoll.epoll_create1 + libc.src.sys.epoll.epoll_ctl + libc.src.sys.epoll.epoll_pwait + libc.src.sys.epoll.epoll_wait + libc.src.sys.epoll.epoll_pwait2 + # sys/mman.h entrypoints libc.src.sys.mman.madvise libc.src.sys.mman.mincore @@ -261,12 +280,6 @@ set(TARGET_LIBC_ENTRYPOINTS # sys/auxv.h entrypoints libc.src.sys.auxv.getauxval - # sys/epoll.h entrypoints - # Disabled due to epoll_wait syscalls not being available on this platform. - # libc.src.sys.epoll.epoll_wait - # libc.src.sys.epoll.epoll_pwait - # libc.src.sys.epoll.epoll_pwait2 - # termios.h entrypoints libc.src.termios.cfgetispeed libc.src.termios.cfgetospeed @@ -302,6 +315,7 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.unistd.linkat libc.src.unistd.lseek libc.src.unistd.pathconf + libc.src.unistd.pipe libc.src.unistd.pread libc.src.unistd.pwrite libc.src.unistd.read @@ -347,6 +361,9 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.atan2f libc.src.math.atanf libc.src.math.atanhf + libc.src.math.canonicalize + libc.src.math.canonicalizef + libc.src.math.canonicalizel libc.src.math.cbrt libc.src.math.cbrtf libc.src.math.ceil @@ -365,6 +382,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.exp10f libc.src.math.exp2 libc.src.math.exp2f + libc.src.math.exp2m1f libc.src.math.expf libc.src.math.expm1 libc.src.math.expm1f @@ -492,6 +510,9 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.rintf libc.src.math.rintl libc.src.math.round + libc.src.math.roundeven + libc.src.math.roundevenf + libc.src.math.roundevenl libc.src.math.roundf libc.src.math.roundl libc.src.math.scalbn @@ -523,8 +544,10 @@ set(TARGET_LIBM_ENTRYPOINTS if(LIBC_TYPES_HAS_FLOAT128) list(APPEND TARGET_LIBM_ENTRYPOINTS # math.h C23 _Float128 entrypoints + libc.src.math.canonicalizef128 libc.src.math.ceilf128 libc.src.math.copysignf128 + libc.src.math.dmulf128 libc.src.math.fabsf128 libc.src.math.fdimf128 libc.src.math.floorf128 @@ -539,6 +562,7 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.fminimum_numf128 libc.src.math.fminimumf128 libc.src.math.fmodf128 + libc.src.math.fmulf128 libc.src.math.frexpf128 libc.src.math.fromfpf128 libc.src.math.fromfpxf128 @@ -556,7 +580,9 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.nextafterf128 libc.src.math.nextdownf128 libc.src.math.nextupf128 + libc.src.math.remquof128 libc.src.math.rintf128 + libc.src.math.roundevenf128 libc.src.math.roundf128 libc.src.math.scalbnf128 libc.src.math.sqrtf128 @@ -566,14 +592,47 @@ if(LIBC_TYPES_HAS_FLOAT128) ) endif() +if(LIBC_COMPILER_HAS_FIXED_POINT) + list(APPEND TARGET_LIBM_ENTRYPOINTS + # stdfix.h _Fract and _Accum entrypoints + libc.src.stdfix.abshk + libc.src.stdfix.abshr + libc.src.stdfix.absk + libc.src.stdfix.abslk + libc.src.stdfix.abslr + libc.src.stdfix.absr + libc.src.stdfix.exphk + libc.src.stdfix.expk + libc.src.stdfix.roundhk + libc.src.stdfix.roundhr + libc.src.stdfix.roundk + libc.src.stdfix.roundlk + libc.src.stdfix.roundlr + libc.src.stdfix.roundr + libc.src.stdfix.rounduhk + libc.src.stdfix.rounduhr + libc.src.stdfix.rounduk + libc.src.stdfix.roundulk + libc.src.stdfix.roundulr + libc.src.stdfix.roundur + libc.src.stdfix.sqrtuhk + libc.src.stdfix.sqrtuhr + libc.src.stdfix.sqrtuk + libc.src.stdfix.sqrtur + libc.src.stdfix.sqrtulr + libc.src.stdfix.uhksqrtus + libc.src.stdfix.uksqrtui + ) +endif() + if(LLVM_LIBC_FULL_BUILD) list(APPEND TARGET_LIBC_ENTRYPOINTS - # compiler entrypoints (no corresponding header) - libc.src.compiler.__stack_chk_fail - # assert.h entrypoints libc.src.assert.__assert_fail + # compiler entrypoints (no corresponding header) + libc.src.compiler.__stack_chk_fail + # dirent.h entrypoints libc.src.dirent.closedir libc.src.dirent.dirfd @@ -598,6 +657,12 @@ if(LLVM_LIBC_FULL_BUILD) libc.src.pthread.pthread_attr_setguardsize libc.src.pthread.pthread_attr_setstack libc.src.pthread.pthread_attr_setstacksize + libc.src.pthread.pthread_condattr_destroy + libc.src.pthread.pthread_condattr_getclock + libc.src.pthread.pthread_condattr_getpshared + libc.src.pthread.pthread_condattr_init + libc.src.pthread.pthread_condattr_setclock + libc.src.pthread.pthread_condattr_setpshared libc.src.pthread.pthread_create libc.src.pthread.pthread_detach libc.src.pthread.pthread_equal @@ -620,6 +685,21 @@ if(LLVM_LIBC_FULL_BUILD) libc.src.pthread.pthread_mutexattr_setrobust libc.src.pthread.pthread_mutexattr_settype libc.src.pthread.pthread_once + libc.src.pthread.pthread_rwlock_destroy + libc.src.pthread.pthread_rwlock_init + libc.src.pthread.pthread_rwlock_rdlock + libc.src.pthread.pthread_rwlock_timedrdlock + libc.src.pthread.pthread_rwlock_timedwrlock + libc.src.pthread.pthread_rwlock_tryrdlock + libc.src.pthread.pthread_rwlock_trywrlock + libc.src.pthread.pthread_rwlock_unlock + libc.src.pthread.pthread_rwlock_wrlock + libc.src.pthread.pthread_rwlockattr_destroy + libc.src.pthread.pthread_rwlockattr_getkind_np + libc.src.pthread.pthread_rwlockattr_getpshared + libc.src.pthread.pthread_rwlockattr_init + libc.src.pthread.pthread_rwlockattr_setkind_np + libc.src.pthread.pthread_rwlockattr_setpshared libc.src.pthread.pthread_self libc.src.pthread.pthread_setname_np libc.src.pthread.pthread_setspecific @@ -643,7 +723,6 @@ if(LLVM_LIBC_FULL_BUILD) libc.src.stdio.fgetc libc.src.stdio.fgetc_unlocked libc.src.stdio.fgets - libc.src.stdio.fileno libc.src.stdio.flockfile libc.src.stdio.fopen libc.src.stdio.fopencookie @@ -652,7 +731,9 @@ if(LLVM_LIBC_FULL_BUILD) libc.src.stdio.fread libc.src.stdio.fread_unlocked libc.src.stdio.fseek + libc.src.stdio.fseeko libc.src.stdio.ftell + libc.src.stdio.ftello libc.src.stdio.funlockfile libc.src.stdio.fwrite libc.src.stdio.fwrite_unlocked @@ -673,9 +754,11 @@ if(LLVM_LIBC_FULL_BUILD) # stdlib.h entrypoints libc.src.stdlib._Exit libc.src.stdlib.abort + libc.src.stdlib.at_quick_exit libc.src.stdlib.atexit libc.src.stdlib.exit libc.src.stdlib.getenv + libc.src.stdlib.quick_exit # signal.h entrypoints libc.src.signal.kill @@ -757,6 +840,10 @@ if(LLVM_LIBC_FULL_BUILD) # sys/select.h entrypoints libc.src.sys.select.select + + # sys/socket.h entrypoints + libc.src.sys.socket.bind + libc.src.sys.socket.socket ) endif() diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 7309e95644c741..e89c50b6e1d3c1 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -228,9 +228,7 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.sys.epoll.epoll_ctl libc.src.sys.epoll.epoll_pwait libc.src.sys.epoll.epoll_wait - # TODO: Need to check if pwait2 is available before providing. - # https://github.com/llvm/llvm-project/issues/80060 - # libc.src.sys.epoll.epoll_pwait2 + libc.src.sys.epoll.epoll_pwait2 # sys/mman.h entrypoints libc.src.sys.mman.madvise diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp index 1b545c50969363..51811a27c1acd6 100644 --- a/libc/src/__support/File/file.cpp +++ b/libc/src/__support/File/file.cpp @@ -282,7 +282,7 @@ int File::ungetc_unlocked(int c) { return c; } -ErrorOr File::seek(long offset, int whence) { +ErrorOr File::seek(off_t offset, int whence) { FileLock lock(this); if (prev_op == FileOp::WRITE && pos > 0) { diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h index 0cedf866519d6b..42e1d11b4ab1a0 100644 --- a/libc/src/__support/File/file.h +++ b/libc/src/__support/File/file.h @@ -183,7 +183,7 @@ class File { return read_unlocked(data, len); } - ErrorOr seek(long offset, int whence); + ErrorOr seek(off_t offset, int whence); ErrorOr tell(); diff --git a/libc/test/src/__support/File/platform_file_test.cpp b/libc/test/src/__support/File/platform_file_test.cpp index 469d7500032b93..8aa07219a6527b 100644 --- a/libc/test/src/__support/File/platform_file_test.cpp +++ b/libc/test/src/__support/File/platform_file_test.cpp @@ -103,7 +103,8 @@ TEST(LlvmLibcPlatformFileTest, CreateAppendSeekAndReadBack) { constexpr size_t APPEND_TEXT_SIZE = sizeof(APPEND_TEXT) - 1; ASSERT_EQ(file->write(APPEND_TEXT, APPEND_TEXT_SIZE).value, APPEND_TEXT_SIZE); - ASSERT_EQ(file->seek(-APPEND_TEXT_SIZE, SEEK_END).value(), 0); + ASSERT_EQ(file->seek(-static_cast(APPEND_TEXT_SIZE), SEEK_END).value(), + 0); char data[APPEND_TEXT_SIZE + 1]; ASSERT_EQ(file->read(data, APPEND_TEXT_SIZE).value, APPEND_TEXT_SIZE); data[APPEND_TEXT_SIZE] = '\0';