[libc-commits] [libc] 8856137 - [libc] Enable a few entrypoints on aarch64 which are now available on x86_64.

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Tue Aug 23 12:32:38 PDT 2022


Author: Siva Chandra
Date: 2022-08-23T12:31:42-07:00
New Revision: 8856137ce7450f17a892f9aeda2d0e5f39c05283

URL: https://github.com/llvm/llvm-project/commit/8856137ce7450f17a892f9aeda2d0e5f39c05283
DIFF: https://github.com/llvm/llvm-project/commit/8856137ce7450f17a892f9aeda2d0e5f39c05283.diff

LOG: [libc] Enable a few entrypoints on aarch64 which are now available on x86_64.

Added: 
    

Modified: 
    libc/config/linux/aarch64/entrypoints.txt
    libc/config/linux/x86_64/entrypoints.txt
    libc/loader/linux/aarch64/start.cpp

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 1024e80eff5a6..17c7c41365318 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -89,18 +89,26 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.stdlib.malloc
     libc.src.stdlib.calloc
     libc.src.stdlib.realloc
+    libc.src.stdlib.aligned_alloc
     libc.src.stdlib.free
 
     # stdio.h entrypoints
     libc.src.stdio.sprintf
     libc.src.stdio.snprintf
 
+    # sys/mman.h entrypoints
+    libc.src.sys.mman.mmap
+    libc.src.sys.mman.munmap
+
     # sys/stat.h entrypoints
+    libc.src.sys.stat.fchmod
     libc.src.sys.stat.mkdir
     libc.src.sys.stat.mkdirat
 
     # unistd.h entrypoints
+    libc.src.unistd.chdir
     libc.src.unistd.close
+    libc.src.unistd.fchdir
     libc.src.unistd.fsync
     libc.src.unistd.lseek
     libc.src.unistd.read
@@ -220,14 +228,46 @@ set(TARGET_LIBM_ENTRYPOINTS
     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
+    # 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_exit
+    libc.src.pthread.pthread_getname_np
+    libc.src.pthread.pthread_getspecific
+    libc.src.pthread.pthread_join
+    libc.src.pthread.pthread_key_create
+    libc.src.pthread.pthread_key_delete
+    libc.src.pthread.pthread_self
+    libc.src.pthread.pthread_setname_np
+    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
+    libc.src.pthread.pthread_setspecific
+
     # stdio.h entrypoints
     libc.src.stdio.clearerr
     libc.src.stdio.clearerr_unlocked
@@ -272,36 +312,12 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.threads.thrd_current
     libc.src.threads.thrd_detach
     libc.src.threads.thrd_equal
+    libc.src.threads.thrd_exit
     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
+    libc.src.threads.tss_create
+    libc.src.threads.tss_delete
+    libc.src.threads.tss_get
+    libc.src.threads.tss_set
 
     # time.h entrypoints
     libc.src.time.asctime

diff  --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 4429f38b21342..37529b2b826f8 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -256,7 +256,6 @@ 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_attr_init
     libc.src.pthread.pthread_create
     libc.src.pthread.pthread_detach
     libc.src.pthread.pthread_equal
@@ -264,10 +263,10 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.pthread.pthread_getname_np
     libc.src.pthread.pthread_getspecific
     libc.src.pthread.pthread_join
-    libc.src.pthread.pthread_self
-    libc.src.pthread.pthread_setname_np
     libc.src.pthread.pthread_key_create
     libc.src.pthread.pthread_key_delete
+    libc.src.pthread.pthread_self
+    libc.src.pthread.pthread_setname_np
     libc.src.pthread.pthread_mutex_destroy
     libc.src.pthread.pthread_mutex_init
     libc.src.pthread.pthread_mutex_lock
@@ -282,12 +281,6 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.pthread.pthread_mutexattr_settype
     libc.src.pthread.pthread_setspecific
 
-    # stdlib.h entrypoints
-    libc.src.stdlib._Exit
-    libc.src.stdlib.atexit
-    libc.src.stdlib.exit
-    libc.src.stdlib.getenv
-
     # stdio.h entrypoints
     libc.src.stdio.clearerr
     libc.src.stdio.clearerr_unlocked
@@ -311,6 +304,12 @@ if(LLVM_LIBC_FULL_BUILD)
     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
+
     # signal.h entrypoints
     # TODO: Enable signal.h entrypoints after fixing signal.h
     # libc.src.signal.raise

diff  --git a/libc/loader/linux/aarch64/start.cpp b/libc/loader/linux/aarch64/start.cpp
index 41fac544cfeac..a28f6a323a80e 100644
--- a/libc/loader/linux/aarch64/start.cpp
+++ b/libc/loader/linux/aarch64/start.cpp
@@ -186,6 +186,8 @@ __attribute__((noinline)) static void do_start() {
     __llvm_libc::set_thread_ptr(tls.tp);
 
   __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib;
+  __llvm_libc::main_thread_attrib.atexit_callback_mgr =
+      __llvm_libc::internal::get_thread_atexit_callback_mgr();
 
   // We want the fini array callbacks to be run after other atexit
   // callbacks are run. So, we register them before running the init


        


More information about the libc-commits mailing list