[libc-commits] [libc] [libc] [startup] add cmake function to merge separated crt1 objects (PR #75413)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Dec 18 14:48:55 PST 2023


================
@@ -27,18 +70,24 @@ function(add_startup_object name)
   )
 endfunction()
 
+check_cxx_compiler_flag("-r" LIBC_LINKER_SUPPORTS_RELOCATABLE)
+
+if(NOT LIBC_LINKER_SUPPORTS_RELOCATABLE)
+  message(STATUS "Skipping startup for target architecture ${LIBC_TARGET_ARCHITECTURE}: linker does not support -r")
+  return()
+endif()
+
 if(NOT (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE}))
   message(STATUS "Skipping startup for target architecture ${LIBC_TARGET_ARCHITECTURE}")
   return()
 endif()
 
 add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
 
-add_startup_object(
+# TODO: factor out crt1 into multiple objects
----------------
nickdesaulniers wrote:

I see what you mean wrt. do_start. Consider expanding further on your comment, unless that's something you intend to pursue immediately after this patch?

https://github.com/llvm/llvm-project/pull/75413


More information about the libc-commits mailing list