[PATCH] D12488: Enable linking tools, shared libraries against libLLVM

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 11:30:31 PDT 2015


rnk added a subscriber: rnk.
rnk added a comment.

Thanks, this is a lot less painful than I thought it'd be.


================
Comment at: tools/llvm-config/CMakeLists.txt:2
@@ -1,2 +1,3 @@
 set(LLVM_LINK_COMPONENTS support)
+set(LLVM_LINK_LLVM_DYLIB OFF)
 
----------------
Maybe throw a comment in here? I'm assuming this is because we want llvm-config to be a tiny statically linked binary for portability.

================
Comment at: tools/llvm-shlib/CMakeLists.txt:71
@@ -48,2 +70,3 @@
+
 if(NOT DEFINED LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
 
----------------
@beanz Why is this code even generating export lists if it wants to export everything? The default Unix behavior is to export all default visibility symbols from shared objects. Here's how I'd structure it:
```
set(LLVM_EXPORTED_SYMBOL_FILE)
if (DEFINED LLVM_LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
  set(LLVM_EXPORTED_SYMBOL_FILE ${LLVM_DYLIB_EXPORTED_SYMBOL_FILE})
  add_custom_target(libLLVMExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE})
elseif (NOT LLVM_DYLIB_EXPORT_ALL)
  # ... C API generation code here
endif()
```

If LLVM_EXPORTED_SYMBOL_FILE is empty, add_llvm_library won't pass it in.

================
Comment at: tools/llvm-shlib/CMakeLists.txt:140
@@ -108,3 +139,3 @@
 
 add_dependencies(LLVM libLLVMExports)
 
----------------
With the suggested structure, this would have to be conditional on `if (LLVM_EXPORTED_SYMBOL_FILE)`.



http://reviews.llvm.org/D12488





More information about the llvm-commits mailing list