[PATCH] D97633: [cmake] Link socket/nsl on SunOS in llvm-jitlink

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 28 09:31:31 PST 2021


nikic created this revision.
nikic added reviewers: lhames, serge-sans-paille.
Herald added subscribers: JDevlieghere, fedor.sergeev, mgorny.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

llvm-jitlink and llvm-jitlink-executor make use of APIs that are part of the socket and nsl libraries on SunOS systems (Solaris and Illumos). Make sure they get linked.

Ran into this in Rust CI when cross-compiling LLVM 12 to these targets.

My cmake-foo is rather weak, so I took inspiration from this check for SunOS: https://github.com/llvm/llvm-project/blob/ca5247bb1770a1dfa56b78303d99f1cc9a0a06ee/llvm/utils/benchmark/src/CMakeLists.txt#L43-L45


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97633

Files:
  llvm/tools/llvm-jitlink/CMakeLists.txt
  llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt


Index: llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
+++ llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
@@ -11,4 +11,9 @@
   intrinsics_gen
 )
 
+message(${CMAKE_SYSTEM_NAME})
+if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+  target_link_libraries(llvm-jitlink-executor PRIVATE socket)
+endif()
+
 export_executable_symbols(llvm-jitlink-executor)
Index: llvm/tools/llvm-jitlink/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-jitlink/CMakeLists.txt
+++ llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -24,4 +24,8 @@
   llvm-jitlink-macho.cpp
   )
 
+if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+  target_link_libraries(llvm-jitlink PRIVATE socket nsl)
+endif()
+
 export_executable_symbols(llvm-jitlink)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97633.326975.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210228/c30c7125/attachment.bin>


More information about the llvm-commits mailing list