Skip to content

Commit df52a22

Browse files
committed
[libc] Make the RPC server target always available
This patch makes sure that we always build the RPC server. The proposed used for this is to begin integrating this server implementation into `libomptarget`. That requires that we build this server ahead of time when using a `LLVM_ENABLE_PROJECTS` build. Make a few tweaks to ensure that the GCC compiler which may be used for this build doesn't complain. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D154105
1 parent 62f57bc commit df52a22

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

libc/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ if(("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD) OR
3535
# When libc is build as part of the runtimes/bootstrap build's CMake run, we
3636
# only need to build the host tools to build the libc. So, we just do enough
3737
# to build libc-hdrgen and return.
38+
39+
# Always make the RPC server availible to other projects for GPU mode.
40+
if(LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
41+
add_subdirectory(utils/gpu/server)
42+
endif()
3843
return()
3944
endif()
4045

libc/utils/gpu/server/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ target_include_directories(llvmlibc_rpc_server PRIVATE ${LIBC_SOURCE_DIR})
55
target_include_directories(llvmlibc_rpc_server PUBLIC ${LIBC_SOURCE_DIR}/include)
66
target_include_directories(llvmlibc_rpc_server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
77

8+
# Ignore unsupported clang attributes if we're using GCC.
9+
target_compile_options(llvmlibc_rpc_server PUBLIC
10+
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>)
11+
812
# Install the server and associated header.
913
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpc_server.h
1014
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gpu-none-llvm/

libc/utils/gpu/server/rpc_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const uint64_t RPC_MAXIMUM_PORT_COUNT = 64;
2222

2323
/// The symbol name associated with the client for use with the LLVM C library
2424
/// implementation.
25-
static const char *rpc_client_symbol_name = "__llvm_libc_rpc_client";
25+
inline const char *rpc_client_symbol_name = "__llvm_libc_rpc_client";
2626

2727
/// status codes.
2828
typedef enum {

0 commit comments

Comments
 (0)