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, 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.