[libc-commits] [libc] [libc] Make `crt1.o` available to clang for GPU builds (PR #100599)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Jul 25 13:24:33 PDT 2024


================
@@ -26,6 +26,16 @@ function(add_startup_object name)
     PROPERTIES
       OUTPUT_NAME ${name}.o
   )
+
+  # Make an executable target of relocatable bitcode for clang if needed.
+  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+    add_executable(${fq_target_name}.exe $<TARGET_OBJECTS:${fq_target_name}>)
+    set_target_properties(${fq_target_name}.exe PROPERTIES
+      RUNTIME_OUTPUT_DIRECTORY ${LIBC_LIBRARY_DIR}
+      RUNTIME_OUTPUT_NAME ${name}.o)
+    target_link_options(${fq_target_name}.exe PRIVATE 
+                        "-flto" "-Wl,--lto-emit-llvm" "-march=sm_90")
----------------
jhuber6 wrote:

Yeah that's a hack, I can probably patch clang for it.

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


More information about the libc-commits mailing list