[libc-commits] [libc] b950a0d - [libc][Obvious] Remove an unnecessary dep and use inline_memcpy.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Mar 22 00:09:53 PDT 2022


Author: Siva Chandra Reddy
Date: 2022-03-22T07:08:57Z
New Revision: b950a0d44d8afd37d7e715507bd10422d53a499e

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

LOG: [libc][Obvious] Remove an unnecessary dep and use inline_memcpy.

An unnecessary dep of the getenv function is removed. From the x86_64
loader, a call to __llvm_libc::memcpy is replaced with call to
__llvm_libc::inline_memcpy.

Added: 
    

Modified: 
    libc/loader/linux/x86_64/CMakeLists.txt
    libc/loader/linux/x86_64/start.cpp
    libc/src/stdlib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/loader/linux/x86_64/CMakeLists.txt b/libc/loader/linux/x86_64/CMakeLists.txt
index e445e30b61979..6c2e615290fa1 100644
--- a/libc/loader/linux/x86_64/CMakeLists.txt
+++ b/libc/loader/linux/x86_64/CMakeLists.txt
@@ -7,7 +7,7 @@ add_loader_object(
     libc.include.sys_mman
     libc.include.sys_syscall
     libc.src.__support.OSUtil.osutil
-    libc.src.string.memcpy
+    libc.src.string.memory_utils.memcpy_implementation
   COMPILE_OPTIONS
     -fno-omit-frame-pointer
     -ffreestanding # To avoid compiler warnings about calling the main function.

diff  --git a/libc/loader/linux/x86_64/start.cpp b/libc/loader/linux/x86_64/start.cpp
index d97c9bc9ae30a..ef413c0e5ffb2 100644
--- a/libc/loader/linux/x86_64/start.cpp
+++ b/libc/loader/linux/x86_64/start.cpp
@@ -8,7 +8,7 @@
 
 #include "config/linux/app.h"
 #include "src/__support/OSUtil/syscall.h"
-#include "src/string/memcpy.h"
+#include "src/string/memory_utils/memcpy_implementations.h"
 
 #include <asm/prctl.h>
 #include <linux/auxvec.h>
@@ -64,8 +64,9 @@ void initTLS() {
   uintptr_t endPtr = reinterpret_cast<uintptr_t>(tlsAddr) + tlsSize;
   *reinterpret_cast<uintptr_t *>(endPtr) = endPtr;
 
-  __llvm_libc::memcpy(tlsAddr, reinterpret_cast<const void *>(app.tls.address),
-                      app.tls.size);
+  __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tlsAddr),
+                             reinterpret_cast<const char *>(app.tls.address),
+                             app.tls.size);
   if (__llvm_libc::syscall(SYS_arch_prctl, ARCH_SET_FS, endPtr) == -1)
     __llvm_libc::syscall(SYS_exit, 1);
 }

diff  --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 77a407347542b..9201c7f521281 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -46,7 +46,6 @@ add_entrypoint_object(
     getenv.h
   DEPENDS
     libc.config.linux.app_h
-    libc.src.string.strncmp
 )
 
 add_entrypoint_object(


        


More information about the libc-commits mailing list