[PATCH] D138278: TableGen: honor LLVM_LINK_LLVM_DYLIB by default

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 02:41:09 PST 2022


nhaehnle created this revision.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, s.egerton, simoncook.
Herald added a reviewer: rriddle.
Herald added a reviewer: antiagainst.
Herald added a project: All.
nhaehnle requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, MLIR, LLVM.

Most TableGen tools have link dependency chains of the form

  ${project}-tblgen -> ${project}Support -> LLVMSupport

In LLVM_LINK_LLVM_DYLIB=ON builds, ${project}Support naturally links
aginst LLVMSupport implicitly by linking against libLLVM-*.so, and so
${project}-tblgen ends up with a dependency on the shared library.

Configuring the tool itself with DISABLE_LLVM_LINK_LLVM_DYLIB then
typically leads to LLVMSupport to be also included statically, leading
to duplicate definitions of symbols from LLVMSupport after the dynamic
linker has done its thing.

TableGen tools simply aren't that special: they can be linked dynamically
just fine, and so we do that to simplify the build setup.

The only exception to this rule is llvm-tblgen itself, which must be
statically linked to avoid circular dependencies of the form

  llvm-tblgen -> llvm-shlib -> tablegen-generated files -> llvm-tblgen


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138278

Files:
  clang/lib/Support/CMakeLists.txt
  clang/utils/TableGen/CMakeLists.txt
  llvm/cmake/modules/CrossCompile.cmake
  llvm/cmake/modules/TableGen.cmake
  llvm/utils/TableGen/CMakeLists.txt
  mlir/lib/Support/CMakeLists.txt
  mlir/lib/TableGen/CMakeLists.txt
  mlir/lib/Tools/PDLL/Parser/CMakeLists.txt
  mlir/lib/Tools/mlir-tblgen/CMakeLists.txt
  mlir/lib/Tools/tblgen-lsp-server/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138278.476400.patch
Type: text/x-patch
Size: 6210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221118/704acc00/attachment.bin>


More information about the llvm-commits mailing list