This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Export component info needed to determine which libraries are in libLLVM.so.
AcceptedPublic

Authored by stellaraccident on Mar 5 2023, 9:25 PM.

Details

Summary
  • Export the GLOBAL property LLVM_COMPONENT_LIBS (this is used by by AddMLIR as a sanity check and the check seems invalid when built standalone without this).
  • Export the per-target LLVM_COMPONENT boolean (can be used to implement a similar check as AddMLIR is doing in unified builds and makes things the same between unified and installed).
  • Define a new GLOBAL property LLVM_DYLIB_INCLUDED_LIBNAMES and export it so that downstreams can reliably query precisely which libraries were included in libLLVM.so and link only what they need without ambiguity. This helps downstreams but will also give us some flexibility in a follow-on to rework the in-tree libLLVM redirect to be more precise (and getting us closer to a semantic that will work for Windows).

With the LLVM_COMPONENT_LIBS exported, it becomes possible for standalone LLVM dependants to call llvm_map_components_to_libnames() and approximate LLVM_DYLIB_INCLUDED_LIBNAMES, but as I was reading through that helper and the related code, I realized there are several special cases such that we really only know this precisely when we build the dylib. So I opted to export that decision for followon work.

Diff Detail

Event Timeline

stellaraccident created this revision.Mar 5 2023, 9:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2023, 9:25 PM
stellaraccident requested review of this revision.Mar 5 2023, 9:25 PM
marbre accepted this revision.Mar 10 2023, 2:59 AM

As far as I see this should be fine, even though I am not 100% familiar with the exact mechanism implemented here.

This revision is now accepted and ready to land.Mar 10 2023, 2:59 AM