Skip to content

Commit 8252d4d

Browse files
[libc] enable most of the entrypoints on aarch64 (#101797)
This is a non-feature change that enables most of the entrypoints for aarch64 based runtime builds. It fixes an additional problem that some compiler-rt targets are not defined at the time of dependency checking thus leading to false-negatives.
1 parent 85da961 commit 8252d4d

File tree

3 files changed

+112
-23
lines changed

3 files changed

+112
-23
lines changed

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ function(get_object_files_for_test result skipped_entrypoints_list)
2222
foreach(dep IN LISTS unchecked_list)
2323
if (NOT TARGET ${dep})
2424
# Skip tests with undefined dependencies.
25-
list(APPEND skipped_list ${dep})
25+
# Compiler-RT targets are added only if they are enabled. However, such targets may not be defined
26+
# at the time of the libc build. We should skip checking such targets.
27+
if (NOT ${dep} MATCHES "^RTScudo.*|^RTGwp.*")
28+
list(APPEND skipped_list ${dep})
29+
endif()
2630
continue()
2731
endif()
2832
get_target_property(aliased_target ${dep} "ALIASED_TARGET")

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ set(TARGET_LIBC_ENTRYPOINTS
6868
libc.src.string.strchr
6969
libc.src.string.strchrnul
7070
libc.src.string.strcmp
71+
libc.src.string.strcoll
7172
libc.src.string.strcpy
7273
libc.src.string.strcspn
7374
libc.src.string.strdup
@@ -90,6 +91,7 @@ set(TARGET_LIBC_ENTRYPOINTS
9091
libc.src.string.strstr
9192
libc.src.string.strtok
9293
libc.src.string.strtok_r
94+
libc.src.string.strxfrm
9395

9496
# inttypes.h entrypoints
9597
libc.src.inttypes.imaxabs
@@ -185,6 +187,9 @@ set(TARGET_LIBC_ENTRYPOINTS
185187
libc.src.stdlib.qsort_r
186188
libc.src.stdlib.rand
187189
libc.src.stdlib.srand
190+
libc.src.stdlib.strfromd
191+
libc.src.stdlib.strfromf
192+
libc.src.stdlib.strfroml
188193
libc.src.stdlib.strtod
189194
libc.src.stdlib.strtof
190195
libc.src.stdlib.strtol
@@ -202,18 +207,34 @@ set(TARGET_LIBC_ENTRYPOINTS
202207

203208
# stdio.h entrypoints
204209
libc.src.stdio.fdopen
205-
#libc.src.stdio.fscanf
210+
libc.src.stdio.fileno
211+
libc.src.stdio.fprintf
212+
libc.src.stdio.fscanf
213+
libc.src.stdio.printf
206214
libc.src.stdio.remove
207215
libc.src.stdio.rename
216+
libc.src.stdio.scanf
208217
libc.src.stdio.snprintf
209218
libc.src.stdio.sprintf
210219
libc.src.stdio.asprintf
211-
#libc.src.stdio.scanf
212-
#libc.src.stdio.sscanf
220+
libc.src.stdio.sscanf
221+
libc.src.stdio.vsscanf
222+
libc.src.stdio.vfprintf
223+
libc.src.stdio.vprintf
213224
libc.src.stdio.vsnprintf
214225
libc.src.stdio.vsprintf
215226
libc.src.stdio.vasprintf
216227

228+
# sys/epoll.h entrypoints
229+
libc.src.sys.epoll.epoll_create
230+
libc.src.sys.epoll.epoll_create1
231+
libc.src.sys.epoll.epoll_ctl
232+
libc.src.sys.epoll.epoll_pwait
233+
libc.src.sys.epoll.epoll_wait
234+
# TODO: Need to check if pwait2 is available before providing.
235+
# https://github.com/llvm/llvm-project/issues/80060
236+
# libc.src.sys.epoll.epoll_pwait2
237+
217238
# sys/mman.h entrypoints
218239
libc.src.sys.mman.madvise
219240
libc.src.sys.mman.mincore
@@ -250,6 +271,10 @@ set(TARGET_LIBC_ENTRYPOINTS
250271
libc.src.sys.stat.mkdirat
251272
libc.src.sys.stat.stat
252273

274+
# sys/statvfs.h
275+
libc.src.sys.statvfs.fstatvfs
276+
libc.src.sys.statvfs.statvfs
277+
253278
# sys/utsname.h entrypoints
254279
libc.src.sys.utsname.uname
255280

@@ -264,12 +289,6 @@ set(TARGET_LIBC_ENTRYPOINTS
264289
# sys/auxv.h entrypoints
265290
libc.src.sys.auxv.getauxval
266291

267-
# sys/epoll.h entrypoints
268-
# Disabled due to epoll_wait syscalls not being available on this platform.
269-
# libc.src.sys.epoll.epoll_wait
270-
# libc.src.sys.epoll.epoll_pwait
271-
# libc.src.sys.epoll.epoll_pwait2
272-
273292
# termios.h entrypoints
274293
libc.src.termios.cfgetispeed
275294
libc.src.termios.cfgetospeed
@@ -306,6 +325,7 @@ set(TARGET_LIBC_ENTRYPOINTS
306325
libc.src.unistd.linkat
307326
libc.src.unistd.lseek
308327
libc.src.unistd.pathconf
328+
libc.src.unistd.pipe
309329
libc.src.unistd.pread
310330
libc.src.unistd.pwrite
311331
libc.src.unistd.read
@@ -319,6 +339,9 @@ set(TARGET_LIBC_ENTRYPOINTS
319339
libc.src.unistd.unlink
320340
libc.src.unistd.unlinkat
321341
libc.src.unistd.write
342+
343+
# wchar.h entrypoints
344+
libc.src.wchar.wctob
322345
)
323346

324347
set(TARGET_LIBM_ENTRYPOINTS
@@ -552,17 +575,27 @@ if(LIBC_TYPES_HAS_FLOAT16)
552575
libc.src.math.canonicalizef16
553576
libc.src.math.ceilf16
554577
libc.src.math.copysignf16
578+
# TODO: aarch64 bug
579+
# Please see https://github.com/llvm/llvm-project/pull/100632#issuecomment-2258772681
580+
# libc.src.math.expf16
555581
libc.src.math.f16add
556582
libc.src.math.f16addf
583+
# libc.src.math.f16addl
557584
libc.src.math.f16div
558585
libc.src.math.f16divf
586+
# libc.src.math.f16divl
587+
libc.src.math.f16fma
559588
libc.src.math.f16fmaf
589+
# libc.src.math.f16fmal
560590
libc.src.math.f16mul
561591
libc.src.math.f16mulf
592+
# libc.src.math.f16mull
562593
libc.src.math.f16sqrt
563594
libc.src.math.f16sqrtf
595+
# libc.src.math.f16sqrtl
564596
libc.src.math.f16sub
565597
libc.src.math.f16subf
598+
# libc.src.math.f16subl
566599
libc.src.math.fabsf16
567600
libc.src.math.fdimf16
568601
libc.src.math.floorf16
@@ -576,6 +609,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
576609
libc.src.math.fminimum_magf16
577610
libc.src.math.fminimum_numf16
578611
libc.src.math.fminimumf16
612+
# libc.src.math.fmodf16
579613
libc.src.math.frexpf16
580614
libc.src.math.fromfpf16
581615
libc.src.math.fromfpxf16
@@ -613,16 +647,30 @@ if(LIBC_TYPES_HAS_FLOAT16)
613647
libc.src.math.ufromfpf16
614648
libc.src.math.ufromfpxf16
615649
)
650+
651+
# if(LIBC_TYPES_HAS_FLOAT128)
652+
# list(APPEND TARGET_LIBM_ENTRYPOINTS
653+
# # math.h C23 mixed _Float16 and _Float128 entrypoints
654+
# libc.src.math.f16addf128
655+
# libc.src.math.f16divf128
656+
# libc.src.math.f16fmaf128
657+
# libc.src.math.f16mulf128
658+
# libc.src.math.f16sqrtf128
659+
# libc.src.math.f16subf128
660+
# )
661+
# endif()
616662
endif()
617663

618664
if(LIBC_TYPES_HAS_FLOAT128)
619665
list(APPEND TARGET_LIBM_ENTRYPOINTS
620666
# math.h C23 _Float128 entrypoints
667+
libc.src.math.canonicalizef128
621668
libc.src.math.ceilf128
622669
libc.src.math.copysignf128
623670
libc.src.math.daddf128
624671
libc.src.math.ddivf128
625672
libc.src.math.dfmaf128
673+
libc.src.math.dmulf128
626674
libc.src.math.dsqrtf128
627675
libc.src.math.dsubf128
628676
libc.src.math.fabsf128
@@ -639,9 +687,11 @@ if(LIBC_TYPES_HAS_FLOAT128)
639687
libc.src.math.fminimum_numf128
640688
libc.src.math.fminimumf128
641689
libc.src.math.fmodf128
690+
libc.src.math.fmulf128
642691
libc.src.math.frexpf128
643692
libc.src.math.fromfpf128
644693
libc.src.math.fromfpxf128
694+
libc.src.math.fsqrtf128
645695
libc.src.math.getpayloadf128
646696
libc.src.math.ilogbf128
647697
libc.src.math.ldexpf128
@@ -659,8 +709,8 @@ if(LIBC_TYPES_HAS_FLOAT128)
659709
libc.src.math.nextupf128
660710
libc.src.math.remquof128
661711
libc.src.math.rintf128
662-
libc.src.math.roundf128
663712
libc.src.math.roundevenf128
713+
libc.src.math.roundf128
664714
libc.src.math.scalbnf128
665715
libc.src.math.setpayloadf128
666716
libc.src.math.sqrtf128
@@ -674,9 +724,18 @@ endif()
674724

675725
if(LLVM_LIBC_FULL_BUILD)
676726
list(APPEND TARGET_LIBC_ENTRYPOINTS
727+
# assert.h entrypoints
728+
libc.src.assert.__assert_fail
729+
677730
# compiler entrypoints (no corresponding header)
678731
libc.src.compiler.__stack_chk_fail
679732

733+
# dirent.h entrypoints
734+
libc.src.dirent.closedir
735+
libc.src.dirent.dirfd
736+
libc.src.dirent.opendir
737+
libc.src.dirent.readdir
738+
680739
# network.h entrypoints
681740
libc.src.network.htonl
682741
libc.src.network.htons
@@ -695,6 +754,12 @@ if(LLVM_LIBC_FULL_BUILD)
695754
libc.src.pthread.pthread_attr_setguardsize
696755
libc.src.pthread.pthread_attr_setstack
697756
libc.src.pthread.pthread_attr_setstacksize
757+
libc.src.pthread.pthread_condattr_destroy
758+
libc.src.pthread.pthread_condattr_getclock
759+
libc.src.pthread.pthread_condattr_getpshared
760+
libc.src.pthread.pthread_condattr_init
761+
libc.src.pthread.pthread_condattr_setclock
762+
libc.src.pthread.pthread_condattr_setpshared
698763
libc.src.pthread.pthread_create
699764
libc.src.pthread.pthread_detach
700765
libc.src.pthread.pthread_equal
@@ -755,7 +820,8 @@ if(LLVM_LIBC_FULL_BUILD)
755820
libc.src.stdio.ferror_unlocked
756821
libc.src.stdio.fflush
757822
libc.src.stdio.fgetc
758-
libc.src.stdio.fileno
823+
libc.src.stdio.fgetc_unlocked
824+
libc.src.stdio.fgets
759825
libc.src.stdio.flockfile
760826
libc.src.stdio.fopen
761827
libc.src.stdio.fopencookie
@@ -764,29 +830,34 @@ if(LLVM_LIBC_FULL_BUILD)
764830
libc.src.stdio.fread
765831
libc.src.stdio.fread_unlocked
766832
libc.src.stdio.fseek
833+
libc.src.stdio.fseeko
834+
libc.src.stdio.ftell
835+
libc.src.stdio.ftello
767836
libc.src.stdio.funlockfile
768837
libc.src.stdio.fwrite
769838
libc.src.stdio.fwrite_unlocked
839+
libc.src.stdio.getc
840+
libc.src.stdio.getc_unlocked
770841
libc.src.stdio.getchar
771842
libc.src.stdio.getchar_unlocked
772-
#TODO: Look into if fprintf can be enabled for overlay on aarch64
773-
libc.src.stdio.fprintf
774-
libc.src.stdio.printf
775843
libc.src.stdio.putc
776844
libc.src.stdio.putchar
777845
libc.src.stdio.puts
846+
libc.src.stdio.setbuf
847+
libc.src.stdio.setvbuf
778848
libc.src.stdio.stderr
779849
libc.src.stdio.stdin
780850
libc.src.stdio.stdout
781-
libc.src.stdio.vfprintf
782-
libc.src.stdio.vprintf
851+
libc.src.stdio.ungetc
783852

784853
# stdlib.h entrypoints
785854
libc.src.stdlib._Exit
786855
libc.src.stdlib.abort
856+
libc.src.stdlib.at_quick_exit
787857
libc.src.stdlib.atexit
788858
libc.src.stdlib.exit
789859
libc.src.stdlib.getenv
860+
libc.src.stdlib.quick_exit
790861

791862
# signal.h entrypoints
792863
libc.src.signal.kill
@@ -800,6 +871,14 @@ if(LLVM_LIBC_FULL_BUILD)
800871
libc.src.signal.signal
801872
libc.src.signal.sigprocmask
802873

874+
# spawn.h entrypoints
875+
libc.src.spawn.posix_spawn
876+
libc.src.spawn.posix_spawn_file_actions_addclose
877+
libc.src.spawn.posix_spawn_file_actions_adddup2
878+
libc.src.spawn.posix_spawn_file_actions_addopen
879+
libc.src.spawn.posix_spawn_file_actions_destroy
880+
libc.src.spawn.posix_spawn_file_actions_init
881+
803882
# search.h entrypoints
804883
libc.src.search.hcreate
805884
libc.src.search.hcreate_r
@@ -860,6 +939,10 @@ if(LLVM_LIBC_FULL_BUILD)
860939

861940
# sys/select.h entrypoints
862941
libc.src.sys.select.select
942+
943+
# sys/socket.h entrypoints
944+
libc.src.sys.socket.bind
945+
libc.src.sys.socket.socket
863946
)
864947
endif()
865948

libc/src/stdlib/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,14 @@ if(NOT LIBC_TARGET_OS_IS_GPU)
350350

351351
list(APPEND SCUDO_DEPS RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
352352
RTScudoStandaloneCWrappers.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO})
353-
354-
list(APPEND SCUDO_DEPS
355-
RTGwpAsan.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
356-
RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
357-
RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
358-
)
353+
354+
if (COMPILER_RT_BUILD_GWP_ASAN)
355+
list(APPEND SCUDO_DEPS
356+
RTGwpAsan.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
357+
RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
358+
RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE_FOR_SCUDO}
359+
)
360+
endif()
359361

360362
add_entrypoint_external(
361363
malloc

0 commit comments

Comments
 (0)