[PATCH] D75579: [WIP] Replace MCTargetOptionsCommandFlags.inc and CommandFlags.inc by libraries

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 16:07:46 PST 2020


serge-sans-paille created this revision.
serge-sans-paille added reviewers: MaskRay, tstellar.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith, steven_wu, gbedwell, aheejin, hiraditya, mgorny, dschuff.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: andreadb.
Herald added projects: clang, LLVM.

MCTargetOptionsCommandFlags.inc and CommandFlags.inc are headers which contain cl::opt with static storage.
These headers are meant to be incuded by tools to make it easier to parametrize codegen/mc.

However, these headers are also included in at least two libraries: lldCommon and handle-llvm. As a result, when creating DYLIB, clang-cpp holds a reference to the options, and lldCommon holds another reference. Linking the two in a single executable, as zig does[0], results in a double registration.

This patch explores an other approach: instead of bundling headers, bindle them as non-component libs, that way we get shared libraries that are only loaded once.

It's a WIP, not fully tested, to gather feedback.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1756977#c5


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75579

Files:
  clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt
  clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
  lld/Common/CMakeLists.txt
  lld/Common/TargetOptionsCommandFlags.cpp
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.inc
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/CommandFlags/CMakeLists.txt
  llvm/lib/CodeGen/CommandFlags/CommandFlags.cpp
  llvm/lib/MC/CMakeLists.txt
  llvm/lib/MC/CommandFlags/CMakeLists.txt
  llvm/lib/MC/CommandFlags/MCTargetOptionsCommandFlags.cpp
  llvm/tools/dsymutil/CMakeLists.txt
  llvm/tools/dsymutil/DwarfStreamer.cpp
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/llc/llc.cpp
  llvm/tools/lli/CMakeLists.txt
  llvm/tools/lli/lli.cpp
  llvm/tools/llvm-dwp/CMakeLists.txt
  llvm/tools/llvm-dwp/llvm-dwp.cpp
  llvm/tools/llvm-isel-fuzzer/CMakeLists.txt
  llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
  llvm/tools/llvm-lto/CMakeLists.txt
  llvm/tools/llvm-lto/llvm-lto.cpp
  llvm/tools/llvm-lto2/CMakeLists.txt
  llvm/tools/llvm-lto2/llvm-lto2.cpp
  llvm/tools/llvm-mc/CMakeLists.txt
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-mca/CMakeLists.txt
  llvm/tools/llvm-mca/llvm-mca.cpp
  llvm/tools/llvm-ml/CMakeLists.txt
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-opt-fuzzer/CMakeLists.txt
  llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
  llvm/tools/lto/CMakeLists.txt
  llvm/tools/lto/lto.cpp
  llvm/tools/opt/CMakeLists.txt
  llvm/tools/opt/opt.cpp
  llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
  llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75579.248061.patch
Type: text/x-patch
Size: 93717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200304/ba858d8c/attachment-0001.bin>


More information about the cfe-commits mailing list