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
    
    # 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
    libc.src.string.memccpy
    libc.src.string.memchr
    libc.src.string.memcmp
    libc.src.string.memcpy
    libc.src.string.memmove
    libc.src.string.mempcpy
    libc.src.string.memrchr
    libc.src.string.memset
    libc.src.string.stpcpy
    libc.src.string.stpncpy
    libc.src.string.strcat
    libc.src.string.strchr
    libc.src.string.strcmp
    libc.src.string.strcpy
    libc.src.string.strcspn
    libc.src.string.strlcat
    libc.src.string.strlcpy
    libc.src.string.strlen
    libc.src.string.strncat
    libc.src.string.strncmp
    libc.src.string.strncpy
    libc.src.string.strnlen
    libc.src.string.strpbrk
    libc.src.string.strrchr
    libc.src.string.strspn
    libc.src.string.strstr
    libc.src.string.strtok
    libc.src.string.strtok_r

    # string.h entrypoints that depend on malloc
    libc.src.string.strdup
    libc.src.string.strndup

    # 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.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.free

    # 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.lseek
    libc.src.unistd.read
    libc.src.unistd.rmdir
    libc.src.unistd.unlink
    libc.src.unistd.unlinkat
    libc.src.unistd.write
)

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.copysign
    libc.src.math.copysignf
    libc.src.math.copysignl
    libc.src.math.ceil
    libc.src.math.ceilf
    libc.src.math.ceill
    libc.src.math.cosf
    libc.src.math.expf
    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.fmax
    libc.src.math.fmaxf
    libc.src.math.fmaxl
    libc.src.math.fmin
    libc.src.math.fminf
    libc.src.math.fminl
    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.llrint
    libc.src.math.llrintf
    libc.src.math.llrintl
    libc.src.math.llround
    libc.src.math.llroundf
    libc.src.math.llroundl
    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.ldexp
    libc.src.math.ldexpf
    libc.src.math.ldexpl
    libc.src.math.log10f
    libc.src.math.log1pf
    libc.src.math.log2f
    libc.src.math.logf
    libc.src.math.logb
    libc.src.math.logbf
    libc.src.math.logbl
    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.sincosf
    libc.src.math.sinf
    libc.src.math.sqrt
    libc.src.math.sqrtf
    libc.src.math.sqrtl
    libc.src.math.trunc
    libc.src.math.truncf
    libc.src.math.truncl

    # sys/mman.h entrypoints
    libc.src.sys.mman.mmap
    libc.src.sys.mman.munmap
)

if(LLVM_LIBC_FULL_BUILD)
  list(APPEND TARGET_LIBC_ENTRYPOINTS
    # 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.fflush
    libc.src.stdio.fopen
    libc.src.stdio.fopencookie
    libc.src.stdio.fread
    libc.src.stdio.fread_unlocked
    libc.src.stdio.fseek
    libc.src.stdio.funlockfile
    libc.src.stdio.fwrite
    libc.src.stdio.fwrite_unlocked
    libc.src.stdio.sprintf
    libc.src.stdio.snprintf
    libc.src.stdio.fprintf
    libc.src.stdio.printf
    libc.src.stdio.stderr
    libc.src.stdio.stdout

    # stdlib.h entrypoints
    libc.src.stdlib._Exit
    libc.src.stdlib.atexit
    libc.src.stdlib.exit
    libc.src.stdlib.getenv

    # 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_join

    # pthread.h entrypoints
    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_join
    libc.src.pthread.pthread_self
    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

    # time.h entrypoints
    libc.src.time.asctime
    libc.src.time.asctime_r
    libc.src.time.gmtime
    libc.src.time.gmtime_r
    libc.src.time.mktime
  )
endif()

set(TARGET_LLVMLIBC_ENTRYPOINTS
  ${TARGET_LIBC_ENTRYPOINTS}
  ${TARGET_LIBM_ENTRYPOINTS}
)
