CMake: Add LLVM_DYLIB_SYMBOL_VERSIONING option
authorTom Stellard <tstellar@redhat.com>
Wed, 3 May 2017 14:43:44 +0000 (14:43 +0000)
committerTom Stellard <tstellar@redhat.com>
Wed, 3 May 2017 14:43:44 +0000 (14:43 +0000)
commitd6f39ddc2649563dd6316ef0396c7e814b90371d
tree55261dce65a971e1ea16583c60d2b2a9aa1cc57e
parent098f4ab699fd70503fdd383002c5f4379a3c025b
CMake: Add LLVM_DYLIB_SYMBOL_VERSIONING option

Summary:
When apps or other libraries link against a library with symbol
versions, the version string is recorded in the import table, and used
at runtime to resolve the symbol back to a library that provides that
version (vaguely like how two-level namespaces work in Mach-O).  ld's
--default-symver flag tags every exported symbol with a symbol version
string equal to the library's soname.  Using --default-symver means
multiple versions of libLLVM can coexist within the same process, at
least to the extent that they don't try to pass data between each
other's llvms.

As an example, imagine a language like Rust using llvm for CPU codegen,
binding to OpenGL, with Mesa as the OpenGL implementation using llvm for
R600 codegen.  With --default-symver Rust and Mesa will resolve their
llvm usage to the version each was linked against, which need not match.

(Other ELF platforms like BSD and Solaris might have similar semantics,
I've not checked.)

This is based on an autoconf version of this patch by Adam Jackson.

This new option can be used to add --default-symver to the linker flags
for libLLVM.so.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D30997

llvm-svn: 302026
llvm/CMakeLists.txt
llvm/tools/llvm-shlib/CMakeLists.txt