[PATCH] D158846: [CMake] Fix BUILD_SHARED_LIBS build on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 07:27:00 PDT 2023


ro added inline comments.


================
Comment at: llvm/cmake/modules/AddLLVM.cmake:652
+    if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+      set_target_properties(${name} PROPERTIES INTERFACE_LINK_LIBRARIES m)
+    endif()
----------------
mgorny wrote:
> But is this dependency really specific to Solaris? I think that if we use `libm` stuff on all platforms, we should link to it whether the linker requires that or not.
> 
> That said, I don't know if the current policy is explicitly not do that.
> But is this dependency really specific to Solaris? I think that if we use `libm` stuff on all platforms, we should link to it whether the linker requires that or not.

No, the use of math functions is everywhere.  Unless there are supported targets that don't have an explicit `libm` (like: folded the math functions into `libc`), this should be safe.

> That said, I don't know if the current policy is explicitly not do that.

I think the Solaris `ld`'s requirement of having self-contained shared objects makes a lot of sense: anything else is bound to cause trouble.  And for static libraries, the dependency has no effect anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158846/new/

https://reviews.llvm.org/D158846



More information about the llvm-commits mailing list