[PATCH] D107559: [clang] Fix libclang linking on Solaris

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 7 12:15:41 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa382a746275b: [clang] Fix libclang linking on Solaris (authored by ro).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107559

Files:
  clang/tools/libclang/CMakeLists.txt
  clang/tools/libclang/libclang.map


Index: clang/tools/libclang/libclang.map
===================================================================
--- clang/tools/libclang/libclang.map
+++ clang/tools/libclang/libclang.map
@@ -1,10 +1,8 @@
-/* If you add a symbol to this file, make sure to add it with the correct
- * version.  For example, if the LLVM main branch is LLVM 14.0.0, add new
- * symbols with the version LLVM_14.
- * On platforms where versions scripts are not used, this file will be used to
- * generate a list of exports for libclang.so
- */
-
+# If you add a symbol to this file, make sure to add it with the correct
+# version.  For example, if the LLVM main branch is LLVM 14.0.0, add new
+# symbols with the version LLVM_14.
+# On platforms where versions scripts are not used, this file will be used to
+# generate a list of exports for libclang.so
 
 LLVM_13 {
   global:
@@ -407,10 +405,9 @@
   local: *;
 };
 
-/* Example of how to add a new symbol version entry.  If you do add a new symbol
- * version, please update the example to depend on the version you added.
- * LLVM_X {
- * global:
- *    clang_newsymbol;
- * };
- */
+# Example of how to add a new symbol version entry.  If you do add a new symbol
+# version, please update the example to depend on the version you added.
+# LLVM_X {
+# global:
+#   clang_newsymbol;
+# };
Index: clang/tools/libclang/CMakeLists.txt
===================================================================
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -162,6 +162,11 @@
   endif()
   if (USE_VERSION_SCRIPT)
     target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+    # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
+    # but requires a special option to enable it.
+    if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+      target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
+    endif()
     # Ensure that libclang.so gets rebuilt when the linker script changes.
     set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
                  OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107559.364975.patch
Type: text/x-patch
Size: 2153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210807/f4cf3463/attachment.bin>


More information about the cfe-commits mailing list