Skip to content
  • Andrew Wilkins's avatar
    Enable linking tools, shared libraries against libLLVM · 9211396d
    Andrew Wilkins authored
    Summary:
    Three closely related changes, to have a mode in which we link all
    executables and shared libraries against libLLVM. 
    
    1. Add a new LLVM_LINK_LLVM_DYLIB cmake option, which, when ON, will link
       executables and shared libraries against libLLVM. For this to work, it
       is necessary to also set LLVM_BUILD_LLVM_DYLIB and LLVM_DYLIB_EXPORT_ALL.
    
       It is not strictly necessary to set LLVM_DISABLE_LLVM_DYLIB_ATEXIT, but
       we also default to OFF in this mode, or tools tend to misbehave (e.g.
       stdout may not flush on exit when output is buffered.)
    
       llvm-config and Tablegen do not use libLLVM, as they are dependencies of
       libLLVM.
    
    2. Modify llvm-go to take a new flag, "linkmode=component-libs|dylib".
       Depending on which one is passed (default is component-libs), we link
       with the individual libraries or libLLVM respectively. We pass in dylib
       when LLVM_LINK_LLVM_DYLIB is ON.
    
    3. Fix LLVM_DYLIB_EXPORT_ALL on Linux, and expand the symbols exported to
       actually export all. Don't strip leading underscore from symbols on Linux,
       and make sure we get all exported symbols and weak-with-default symbols
       ("W" in nm output). Without these changes, passes won't load because
       the "Annotate..." symbols defined in lib/Support/Valigrind.cpp are not
       found.
    
    Testing:
     - Ran default build ("ninja") with LLVM, clang, compiler-rt, llgo, lldb.
     - Ran "check", "check-clang", "check-tsan", "check-libgo" targets. I've
       never had much success with LLDB tests, and llgoi is currently broken
       so check-llgo fails for an unrelated reason.
     - Ran "lldb" to ensure it loads.
    
    Reviewers: chandlerc, beanz, pcc, rnk
    
    Subscribers: rnk, chapuni, sylvestre.ledru, llvm-commits
    
    Differential Revision: http://reviews.llvm.org/D12488
    
    llvm-svn: 246527
    9211396d
Loading