[libc] Support add_object_library for the GPU build
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 16 Feb 2023 20:46:39 +0000 (14:46 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Mon, 20 Feb 2023 15:37:18 +0000 (09:37 -0600)
commitd51d2b5909036cd13fcca7d5b5d1bed48dff3053
treee7d6eaddb7b0d990b789447ecb2a14fd4eb49c65
parent287267c23a08e3ba7dd5df2d07f48b71d4922576
[libc] Support add_object_library for the GPU build

This patch unifies the handling of generating the GPU build targets
between the `add_entrypoint_library` and the `add_object_library`
functions. The `_build_gpu_objects` function will create two targets.
One contains a single object file with several GPU binaries embedded in
it, a so-called fatbinary. The other is a direct compile of the
supported target to be used internally only. This patch pulls out some
of the properties logic so that we can handle both more easily. This
patch also required adding an ovverride  `NO_GPU_BUILD` for cases when
we only want to build the source file as normal.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D144214
libc/cmake/modules/LLVMLibCObjectRules.cmake
libc/startup/gpu/amdgpu/CMakeLists.txt
libc/startup/gpu/nvptx/CMakeLists.txt