diff options
author | Michael Jones <michaelrj@google.com> | 2020-12-23 18:46:09 +0000 |
---|---|---|
committer | Michael Jones <michaelrj@google.com> | 2021-01-08 23:52:35 +0000 |
commit | a0b65a7bcd6065688189b3d678c42ed6af9603db (patch) | |
tree | 297d25827bcf2c7e27eaa0c209004cd6ac39d791 /libc/src/threads/linux | |
parent | daaaed6bb89044ac58a23f1bb1ccdd12342a5a58 (diff) | |
download | llvm-a0b65a7bcd6065688189b3d678c42ed6af9603db.zip llvm-a0b65a7bcd6065688189b3d678c42ed6af9603db.tar.gz llvm-a0b65a7bcd6065688189b3d678c42ed6af9603db.tar.bz2 |
[libc] Switch to use a macro which does not insert a section for every libc function.
Summary:
The new macro also inserts the C alias for the C++ implementations
without needing an objcopy based post processing step. The CMake
rules have been updated to reflect this. More CMake cleanup can be
taken up in future rounds and appropriate TODOs have been added for them.
Reviewers: mcgrathr, sivachandra
Subscribers:
Diffstat (limited to 'libc/src/threads/linux')
-rw-r--r-- | libc/src/threads/linux/call_once.cpp | 3 | ||||
-rw-r--r-- | libc/src/threads/linux/mtx_init.cpp | 2 | ||||
-rw-r--r-- | libc/src/threads/linux/mtx_lock.cpp | 2 | ||||
-rw-r--r-- | libc/src/threads/linux/mtx_unlock.cpp | 2 | ||||
-rw-r--r-- | libc/src/threads/linux/thrd_create.cpp | 4 | ||||
-rw-r--r-- | libc/src/threads/linux/thrd_join.cpp | 2 |
6 files changed, 8 insertions, 7 deletions
diff --git a/libc/src/threads/linux/call_once.cpp b/libc/src/threads/linux/call_once.cpp index 058f370..9e1d935 100644 --- a/libc/src/threads/linux/call_once.cpp +++ b/libc/src/threads/linux/call_once.cpp @@ -22,7 +22,8 @@ static constexpr unsigned START = 0x11; static constexpr unsigned WAITING = 0x22; static constexpr unsigned FINISH = 0x33; -void LLVM_LIBC_ENTRYPOINT(call_once)(once_flag *flag, __call_once_func_t func) { +LLVM_LIBC_FUNCTION(void, call_once, + (once_flag * flag, __call_once_func_t func)) { FutexData *futex_word = reinterpret_cast<FutexData *>(flag); unsigned int not_called = ONCE_FLAG_INIT; diff --git a/libc/src/threads/linux/mtx_init.cpp b/libc/src/threads/linux/mtx_init.cpp index 329843c..610098a 100644 --- a/libc/src/threads/linux/mtx_init.cpp +++ b/libc/src/threads/linux/mtx_init.cpp @@ -12,7 +12,7 @@ namespace __llvm_libc { -int LLVM_LIBC_ENTRYPOINT(mtx_init)(mtx_t *mutex, int type) { +LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * mutex, int type)) { *(reinterpret_cast<uint32_t *>(mutex->__internal_data)) = MS_Free; mutex->__mtx_type = type; return thrd_success; diff --git a/libc/src/threads/linux/mtx_lock.cpp b/libc/src/threads/linux/mtx_lock.cpp index 44a82df..923b1b6 100644 --- a/libc/src/threads/linux/mtx_lock.cpp +++ b/libc/src/threads/linux/mtx_lock.cpp @@ -18,7 +18,7 @@ namespace __llvm_libc { // The implementation currently handles only plain mutexes. -int LLVM_LIBC_ENTRYPOINT(mtx_lock)(mtx_t *mutex) { +LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) { FutexData *futex_data = reinterpret_cast<FutexData *>(mutex->__internal_data); while (true) { uint32_t mutex_status = MS_Free; diff --git a/libc/src/threads/linux/mtx_unlock.cpp b/libc/src/threads/linux/mtx_unlock.cpp index 2517063..370e1b1 100644 --- a/libc/src/threads/linux/mtx_unlock.cpp +++ b/libc/src/threads/linux/mtx_unlock.cpp @@ -18,7 +18,7 @@ namespace __llvm_libc { // The implementation currently handles only plain mutexes. -int LLVM_LIBC_ENTRYPOINT(mtx_unlock)(mtx_t *mutex) { +LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) { FutexData *futex_word = reinterpret_cast<FutexData *>(mutex->__internal_data); while (true) { uint32_t mutex_status = MS_Waiting; diff --git a/libc/src/threads/linux/thrd_create.cpp b/libc/src/threads/linux/thrd_create.cpp index 946000e..ff47e53 100644 --- a/libc/src/threads/linux/thrd_create.cpp +++ b/libc/src/threads/linux/thrd_create.cpp @@ -35,8 +35,8 @@ static __attribute__((noinline)) void start_thread() { start_args->func(start_args->arg)); } -int LLVM_LIBC_ENTRYPOINT(thrd_create)(thrd_t *thread, thrd_start_t func, - void *arg) { +LLVM_LIBC_FUNCTION(int, thrd_create, + (thrd_t * thread, thrd_start_t func, void *arg)) { unsigned clone_flags = CLONE_VM // Share the memory space with the parent. | CLONE_FS // Share the file system with the parent. diff --git a/libc/src/threads/linux/thrd_join.cpp b/libc/src/threads/linux/thrd_join.cpp index 18e6b6f..c0ad33c 100644 --- a/libc/src/threads/linux/thrd_join.cpp +++ b/libc/src/threads/linux/thrd_join.cpp @@ -18,7 +18,7 @@ namespace __llvm_libc { -int LLVM_LIBC_ENTRYPOINT(thrd_join)(thrd_t *thread, int *retval) { +LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t * thread, int *retval)) { FutexData *clear_tid_address = reinterpret_cast<FutexData *>(thread->__clear_tid); |