[libc-commits] [libc] 5fde2d9 - [libc] Write stub files to a new directory to avoid conflicts

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Feb 13 14:40:22 PST 2023


Author: Joseph Huber
Date: 2023-02-13T16:39:59-06:00
New Revision: 5fde2d99513fd298521bf8d651bdde802105c0c5

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

LOG: [libc] Write stub files to a new directory to avoid conflicts

Summary:
This hack with stub files is used to make the final object archive
have human-understandable names. We currently output these into the
current binary directory, which sometimes interferes with the actual
source file. Put these in their own directory to be certain they don't
conflict.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 4100d3d482878..ae7257e5660c5 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -136,17 +136,17 @@ function(_build_gpu_entrypoint_objects fq_target_name)
   #       into a single bitcode file and use that. For now we simply build for
   #       every single one and let the offloading linker handle it.
   get_filename_component(stub_filename ${ADD_GPU_ENTRYPOINT_OBJ_SRCS} NAME)
-  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${stub_filename} "// Empty file.\n")
+  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stubs)
+  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename} "// Empty file.\n")
   add_library(
     ${fq_target_name}
     # We want an object library as the objects will eventually get packaged into
     # an archive (like libcgpu.a).
     EXCLUDE_FROM_ALL
     OBJECT
-    "${CMAKE_CURRENT_BINARY_DIR}/${stub_filename}"
+    "${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename}"
   )
   target_compile_options(${fq_target_name} BEFORE PRIVATE ${common_compile_options}
-                         -DLLVM_LIBC_PUBLIC_PACKAGING
                          -nostdlib -Xclang -fembed-offload-object=${packaged_output_name})
   target_include_directories(${fq_target_name} PRIVATE ${include_dirs})
   add_dependencies(${fq_target_name} ${full_deps_list} ${packaged_target_name})


        


More information about the libc-commits mailing list