Skip to content

Commit 18edc33

Browse files
[libc] fix aarch64 linux full build
1 parent f941908 commit 18edc33

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ if(LLVM_LIBC_FULL_BUILD)
643643
libc.src.pthread.pthread_mutexattr_setrobust
644644
libc.src.pthread.pthread_mutexattr_settype
645645
libc.src.pthread.pthread_once
646+
libc.src.pthread.pthread_rwlockattr_destroy
647+
libc.src.pthread.pthread_rwlockattr_getkind_np
648+
libc.src.pthread.pthread_rwlockattr_getpshared
649+
libc.src.pthread.pthread_rwlockattr_init
650+
libc.src.pthread.pthread_rwlockattr_setkind_np
651+
libc.src.pthread.pthread_rwlockattr_setpshared
646652
libc.src.pthread.pthread_setspecific
647653

648654
# sched.h entrypoints
@@ -753,6 +759,7 @@ if(LLVM_LIBC_FULL_BUILD)
753759
libc.src.unistd._exit
754760
libc.src.unistd.environ
755761
libc.src.unistd.execv
762+
libc.src.unistd.fork
756763
libc.src.unistd.getopt
757764
libc.src.unistd.optarg
758765
libc.src.unistd.optind

libc/src/__support/threads/linux/CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ add_header_library(
2222
libc.src.__support.time.linux.abs_timeout
2323
)
2424

25-
set(raw_mutex_additional_flags)
25+
set(monotonicity_flags)
2626
if (LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY)
27-
set(raw_mutex_additional_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1)
27+
set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1)
2828
else()
29-
set(raw_mutex_additional_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=0)
29+
set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=0)
3030
endif()
3131

3232
add_header_library(
@@ -42,8 +42,22 @@ add_header_library(
4242
libc.hdr.types.pid_t
4343
COMPILE_OPTIONS
4444
-DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=${LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT}
45-
${raw_mutex_additional_flags}
46-
45+
${monotonicity_flags}
46+
)
47+
48+
add_header_library(
49+
rwlock
50+
HDRS
51+
rwlock.h
52+
DEPENDS
53+
.futex_utils
54+
.raw_mutex
55+
libc.src.__support.common
56+
libc.src.__support.OSUtil.osutil
57+
libc.src.__support.CPP.limits
58+
COMPILE_OPTIONS
59+
-DLIBC_COPT_RWLOCK_DEFAULT_SPIN_COUNT=${LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT}
60+
${monotonicity_flags}
4761
)
4862

4963
add_header_library(
@@ -64,6 +78,7 @@ add_object_library(
6478
.futex_utils
6579
libc.config.linux.app_h
6680
libc.include.sys_syscall
81+
libc.include.fcntl
6782
libc.src.errno.errno
6883
libc.src.__support.CPP.atomic
6984
libc.src.__support.CPP.stringstream

libc/test/IntegrationTest/test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@ void *realloc(void *ptr, size_t s) {
7979
// Integration tests are linked with -nostdlib. BFD linker expects
8080
// __dso_handle when -nostdlib is used.
8181
void *__dso_handle = nullptr;
82+
83+
// On some platform (aarch64 fedora tested) full build integration test
84+
// objects need to link against libgcc, which may expect a __getauxval
85+
// function. For now, it is fine to provide a weak definition that always
86+
// returns false.
87+
[[gnu::weak]] bool __getauxval(uint64_t, uint64_t *) { return false; }
8288
} // extern "C"

0 commit comments

Comments
 (0)