[libc-commits] [libc] [libc][NFC] Remove unused add_redirector_object and add_redirector_library in cmake. (PR #156485)

via libc-commits libc-commits at lists.llvm.org
Tue Sep 2 09:29:01 PDT 2025


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/156485

None

>From 445639e715c95c0cde109543a5426b2d743b67ff Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Tue, 2 Sep 2025 16:27:14 +0000
Subject: [PATCH] [libc][NFC] Remove unused add_redirector_object and
 add_redirector_library in cmake.

---
 libc/cmake/modules/LLVMLibCLibraryRules.cmake | 29 -------------------
 libc/cmake/modules/LLVMLibCObjectRules.cmake  | 25 ----------------
 2 files changed, 54 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
index b464c189420b7..80439de6bb4b0 100644
--- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -151,35 +151,6 @@ function(add_entrypoint_library target_name)
   set_target_properties(${target_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${LIBC_LIBRARY_DIR})
 endfunction(add_entrypoint_library)
 
-# Rule to build a shared library of redirector objects.
-function(add_redirector_library target_name)
-  cmake_parse_arguments(
-    "REDIRECTOR_LIBRARY"
-    ""
-    ""
-    "DEPENDS"
-    ${ARGN}
-  )
-
-  set(obj_files "")
-  foreach(dep IN LISTS REDIRECTOR_LIBRARY_DEPENDS)
-    # TODO: Ensure that each dep is actually a add_redirector_object target.
-    list(APPEND obj_files $<TARGET_OBJECTS:${dep}>)
-  endforeach(dep)
-
-  # TODO: Call the linker explicitly instead of calling the compiler driver to
-  # prevent DT_NEEDED on C++ runtime.
-  add_library(
-    ${target_name}
-    EXCLUDE_FROM_ALL
-    SHARED
-    ${obj_files}
-  )
-  set_target_properties(${target_name}  PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBC_LIBRARY_DIR})
-  target_link_libraries(${target_name}  -nostdlib -lc -lm)
-  set_target_properties(${target_name}  PROPERTIES LINKER_LANGUAGE "C")
-endfunction(add_redirector_library)
-
 set(HDR_LIBRARY_TARGET_TYPE "HDR_LIBRARY")
 
 # Internal function, used by `add_header_library`.
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 030157bf64585..6c534dfccec10 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -470,31 +470,6 @@ function(add_entrypoint_external target_name)
 
 endfunction(add_entrypoint_external)
 
-# Rule build a redirector object file.
-function(add_redirector_object target_name)
-  cmake_parse_arguments(
-    "REDIRECTOR_OBJECT"
-    "" # No optional arguments
-    "SRC" # The cpp file in which the redirector is defined.
-    "" # No multivalue arguments
-    ${ARGN}
-  )
-  if(NOT REDIRECTOR_OBJECT_SRC)
-    message(FATAL_ERROR "'add_redirector_object' rule requires SRC option listing one source file.")
-  endif()
-
-  add_library(
-    ${target_name}
-    EXCLUDE_FROM_ALL
-    OBJECT
-    ${REDIRECTOR_OBJECT_SRC}
-  )
-  target_compile_options(
-    ${target_name}
-    BEFORE PRIVATE -fPIC ${LIBC_COMPILE_OPTIONS_DEFAULT}
-  )
-endfunction(add_redirector_object)
-
 # Helper to define a function with multiple implementations
 # - Computes flags to satisfy required/rejected features and arch,
 # - Declares an entry point,



More information about the libc-commits mailing list