Skip to content

Conversation

@jonathonpenix
Copy link

@jonathonpenix jonathonpenix commented Jan 7, 2026

LLVM_DISTRIBUTION_COMPONENTS seems to require that each component have
a) install-* and install-*-stripped targets and b) a component associated with
the things to install.

So, there's a few separate changes made to add this support into eld:

  • For each of the components we want to support, add_llvm_install_targets
    is used to create the install* and install-*-stripped targets. I think this
    is the easiest (and a recommended) way to do this.

  • I think eld has five components we need to handle: ld.eld, LW,
    PluginAPIHeaders, linker-script (templates), and YAMLMapParser. Each
    of these had the appropriate install targets and components added, as
    needed. Hopefully I'm not missing any additional components we need to
    consider for distributions.

    It might make sense to more aggressively couple some of these, but I
    think the granularity here matches pretty well with available CMake
    options (to ex: disable the YAMLMapParser) and current toolchains with
    eld included (where the PluginAPIHeaders, templates, etc. may be stripped
    out). So, I left this as-is.

  • A dependency was added between the ld.eld and LW install targets--without
    these ld.eld would always fail at runtime about the missing LW library, if
    only ex: ninja install-ld.eld was run. Which, doesn't seem that helpful.
    So, make ld.eld's install depend on LW's.

Expected usage looks something like:

-DLLVM_DISTRIBUTION_COMPONENTS='...;ld.eld;LW;PluginAPIHeaders;linker-script;YAMLMapParser'

and these items can generally be added/removed based on what people want in
the distribution (modulo ld.eld's dependency on LW).

And, as per the install-* target requirement mentioned above, each of
these components can now be individually installed with ex: install-ld.eld.

Fixes #693

@quic-k
Copy link
Contributor

quic-k commented Jan 7, 2026

will this patch allow me to do ninja install-ld.eld same as ninja install-clang?

@jonathonpenix
Copy link
Author

Yep!

Playing with this a bit though now that you mention it, it looks like doing just a ninja install-ld.eld doesn't also install LW which kind of breaks things (errors when running eld unless ninja install-LW is also run). Will look at that and see if that can be changed.

@quic-k
Copy link
Contributor

quic-k commented Jan 7, 2026

Yep!

great, this is useful

Playing with this a bit though now that you mention it, it looks like doing just a ninja install-ld.eld doesn't also install LW which kind of breaks things (errors when running eld unless ninja install-LW is also run). Will look at that and see if that can be changed.

probably need to add LW as ld.eld's dependency

@jonathonpenix jonathonpenix marked this pull request as ready for review January 7, 2026 23:56
@jonathonpenix
Copy link
Author

probably need to add LW as ld.eld's dependency

Yep! I think that works

@quic-seaswara
Copy link
Contributor

quic-seaswara commented Jan 8, 2026

The header files for linker plugin API need to be in the distribution too. How will that work ?

The header files are installed from llvm/tools/eld/include/eld

@jonathonpenix
Copy link
Author

Oh, whoops. It should just be adding the relevant install targets again (llvm projects do similar things, ex: https://github.com/llvm/llvm-project/blob/de3e9b04178cc8fca77ef6396ba604f47ffdeb6f/clang/CMakeLists.txt#L408-L414) then ex: -DLLVM_DISTRIBUTION_COMPONENTS='...;ld.eld;LW;PluginAPIHeaders'. So, I think that shouldn't be much of an issue/I'll make that change.

As a more general question though, does it make sense that these should all be installed/listed separately? Seems like LW is essentially required by eld and the plugin headers are basically always enabled as far as I can tell (the cache var is FORCE'ed to be on)

LLVM_DISTRIBUTION_COMPONENTS seems to require that each component have
a) install-* and install-*-stripped targets and b) a component associated with
the things to install.

So, there's a few separate changes made to add this support into eld:
- For each of the components we want to support, `add_llvm_install_targets`
  is used to create the install* and install-*-stripped targets. I think this
  is the easiest (and a recommended) way to do this.
- I think eld has five components we need to handle: ld.eld, LW,
  PluginAPIHeaders, linker-script (templates), and YAMLMapParser. Each
  of these had the appropriate install targets and components added, as
  needed. Hopefully I'm not missing any additional components we need to
  consider for distributions.

  It might make sense to more aggressively couple some of these, but I
  think the granularity here matches pretty well with available CMake
  options (to ex: disable the YAMLMapParser) and current toolchains with
  eld included (where the PluginAPIHeaders, templates, etc. may be stripped
  out). So, I left this as-is.
- A dependency was added between the ld.eld and LW install targets--without
  these ld.eld would always fail at runtime about the missing LW library, if
  only ex: `ninja install-ld.eld` was run. Which, doesn't seem that helpful.
  So, make ld.eld's install depend on LW's.

Expected usage looks something like:

`-DLLVM_DISTRIBUTION_COMPONENTS='...;ld.eld;LW;PluginAPIHeaders;linker-script;YAMLMapParser'`

and these items can generally be added/removed based on what people want in
the distribution (modulo ld.eld's dependency on LW).

And, as per the install-* target requirement mentioned above, each of
these components can now be individually installed with ex: install-ld.eld.

Fixes qualcomm#693

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compatibility with LLVM_DISTRIBUTION_COMPONENTS

3 participants